summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-02-03 23:21:37 +0000
committerNicholas Clark <nick@ccl4.org>2006-02-03 23:21:37 +0000
commitfaef540c8909a0bd99951f9de3e335c74b33dad1 (patch)
treedd42b0f5c4a9fa083d74b28df09f3a2b3084a705 /perl.c
parent97bd566409a94bf7961734af3ac8131276ce086b (diff)
downloadperl-faef540c8909a0bd99951f9de3e335c74b33dad1.tar.gz
S_find_beginning is only called from one place, so by hoisting the
forbid_setid check for -x into the caller, we can eliminate the suidscript parameter from S_find_beginning. p4raw-id: //depot/perl@27076
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/perl.c b/perl.c
index cf84f86755..ad9eaf2694 100644
--- a/perl.c
+++ b/perl.c
@@ -2050,7 +2050,13 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit)
|| gMacPerl_AlwaysExtract
#endif
) {
- find_beginning(suidscript);
+
+ /* This will croak if suidscript is >= 0, as -x cannot be used with
+ setuid scripts. */
+ forbid_setid('x', suidscript);
+ /* Hence you can't get here if suidscript >= 0 */
+
+ find_beginning();
if (cddir && PerlDir_chdir( (char *)cddir ) < 0)
Perl_croak(aTHX_ "Can't chdir to %s",cddir);
}
@@ -4218,7 +4224,7 @@ FIX YOUR KERNEL, PUT A C WRAPPER AROUND THIS SCRIPT, OR USE -u AND UNDUMP!\n");
}
STATIC void
-S_find_beginning(pTHX_ const int suidscript)
+S_find_beginning(pTHX)
{
dVAR;
register char *s;
@@ -4229,11 +4235,6 @@ S_find_beginning(pTHX_ const int suidscript)
/* skip forward in input to the real script? */
- /* This will croak if suidscript is >= 0, as -x cannot be used with
- setuid scripts. */
- forbid_setid('x', suidscript);
- /* Hence you can't get here if suidscript >= 0 */
-
#ifdef MACOS_TRADITIONAL
/* Since the Mac OS does not honor #! arguments for us, we do it ourselves */