diff options
author | Nicholas Clark <nick@ccl4.org> | 2012-02-23 15:44:33 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2012-02-27 11:31:48 +0100 |
commit | 8d1138377104247a841c52023a0f6d0c9ea464a8 (patch) | |
tree | 13baf8c2209c04bb561a511609af17bab0cbfa09 /perl.c | |
parent | 286a76ab020bbce3bb02a3c2490a7a01ad781c47 (diff) | |
download | perl-8d1138377104247a841c52023a0f6d0c9ea464a8.tar.gz |
In perl.c, change S_open_script() to return rsfp.
Previously it was being passed &rsfp as a parameter, because it was
returning another value, fdscript. However, the return value has been
ignored since commit cc69b689ee7c2745 removed suidperl in January 2009.
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -2073,7 +2073,7 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) { bool suidscript = FALSE; - open_script(scriptname, dosearch, &suidscript, &rsfp); + rsfp = open_script(scriptname, dosearch, &suidscript); validate_suid(validarg, scriptname, fdscript, suidscript, linestr_sv, rsfp); @@ -3614,11 +3614,11 @@ S_init_main_stash(pTHX) sv_setpvs(get_sv("/", GV_ADD), "\n"); } -STATIC int -S_open_script(pTHX_ const char *scriptname, bool dosearch, - bool *suidscript, PerlIO **rsfpp) +STATIC PerlIO * +S_open_script(pTHX_ const char *scriptname, bool dosearch, bool *suidscript) { int fdscript = -1; + PerlIO *rsfp = NULL; dVAR; PERL_ARGS_ASSERT_OPEN_SCRIPT; @@ -3668,16 +3668,16 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, if (*PL_origfilename == '-' && PL_origfilename[1] == '\0') scriptname = (char *)""; if (fdscript >= 0) { - *rsfpp = PerlIO_fdopen(fdscript,PERL_SCRIPT_MODE); + rsfp = PerlIO_fdopen(fdscript,PERL_SCRIPT_MODE); # if defined(HAS_FCNTL) && defined(F_SETFD) - if (*rsfpp) + if (rsfp) /* ensure close-on-exec */ - fcntl(PerlIO_fileno(*rsfpp),F_SETFD,1); + fcntl(PerlIO_fileno(rsfp),F_SETFD,1); # endif } else if (!*scriptname) { forbid_setid(0, *suidscript); - *rsfpp = PerlIO_stdin(); + rsfp = PerlIO_stdin(); } else { #ifdef FAKE_BIT_BUCKET @@ -3712,7 +3712,7 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, #endif } #endif - *rsfpp = PerlIO_open(scriptname,PERL_SCRIPT_MODE); + rsfp = PerlIO_open(scriptname,PERL_SCRIPT_MODE); #ifdef FAKE_BIT_BUCKET if (memEQ(scriptname, FAKE_BIT_BUCKET_PREFIX, sizeof(FAKE_BIT_BUCKET_PREFIX) - 1) @@ -3722,12 +3722,12 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, scriptname = BIT_BUCKET; #endif # if defined(HAS_FCNTL) && defined(F_SETFD) - if (*rsfpp) + if (rsfp) /* ensure close-on-exec */ - fcntl(PerlIO_fileno(*rsfpp),F_SETFD,1); + fcntl(PerlIO_fileno(rsfp),F_SETFD,1); # endif } - if (!*rsfpp) { + if (!rsfp) { /* PSz 16 Sep 03 Keep neat error message */ if (PL_e_script) Perl_croak(aTHX_ "Can't open "BIT_BUCKET": %s\n", Strerror(errno)); @@ -3735,7 +3735,7 @@ S_open_script(pTHX_ const char *scriptname, bool dosearch, Perl_croak(aTHX_ "Can't open perl script \"%s\": %s\n", CopFILE(PL_curcop), Strerror(errno)); } - return fdscript; + return rsfp; } /* Mention |