#endif
#if defined(PERL_IN_PERL_C) || defined(PERL_DECL_PROT)
-s |void |find_beginning
+s |void |find_beginning |NN SV* linestr_sv
s |void |forbid_setid |const char flag|const int suidscript
s |void |incpush |NULLOK const char *dir|bool addsubdirs|bool addoldvers|bool usesep|bool canrelocate
s |void |init_interp
s |void |usage |NN const char *name
s |void |validate_suid |NN const char *validarg \
|NN const char *scriptname|int fdscript \
- |int suidscript
+ |int suidscript|NN SV* linestr_sv
# if defined(IAMSUID)
s |int |fd_on_nosuid_fs|int fd
# endif
#endif
#if defined(PERL_IN_PERL_C) || defined(PERL_DECL_PROT)
#ifdef PERL_CORE
-#define find_beginning() S_find_beginning(aTHX)
+#define find_beginning(a) S_find_beginning(aTHX_ a)
#define forbid_setid(a,b) S_forbid_setid(aTHX_ a,b)
#define incpush(a,b,c,d,e) S_incpush(aTHX_ a,b,c,d,e)
#define init_interp() S_init_interp(aTHX)
#define nuke_stacks() S_nuke_stacks(aTHX)
#define open_script(a,b,c,d) S_open_script(aTHX_ a,b,c,d)
#define usage(a) S_usage(aTHX_ a)
-#define validate_suid(a,b,c,d) S_validate_suid(aTHX_ a,b,c,d)
+#define validate_suid(a,b,c,d,e) S_validate_suid(aTHX_ a,b,c,d,e)
#endif
# if defined(IAMSUID)
#ifdef PERL_CORE
#ifdef USE_SITECUSTOMIZE
bool minus_f = FALSE;
#endif
+ SV *linestr_sv = newSV_type(SVt_PVIV);
+
+ SvGROW(linestr_sv, 80);
+ sv_setpvn(linestr_sv,"",0);
- sv_setpvn(PL_linestr,"",0);
sv = newSVpvs(""); /* first used for -I flags */
SAVEFREESV(sv);
init_main_stash();
const int fdscript
= open_script(scriptname, dosearch, sv, &suidscript);
- validate_suid(validarg, scriptname, fdscript, suidscript);
+ validate_suid(validarg, scriptname, fdscript, suidscript, linestr_sv);
#ifndef PERL_MICRO
# if defined(SIGCHLD) || defined(SIGCLD)
forbid_setid('x', suidscript);
/* Hence you can't get here if suidscript >= 0 */
- find_beginning();
+ find_beginning(linestr_sv);
if (cddir && PerlDir_chdir( (char *)cddir ) < 0)
Perl_croak(aTHX_ "Can't chdir to %s",cddir);
}
tmpfp = PL_rsfp;
PL_rsfp = NULL;
- lex_start(PL_linestr);
+ lex_start(linestr_sv);
PL_rsfp = tmpfp;
PL_subname = newSVpvs("main");
STATIC void
S_validate_suid(pTHX_ const char *validarg, const char *scriptname,
- int fdscript, int suidscript)
+ int fdscript, int suidscript, SV *linestr_sv)
{
dVAR;
#ifdef IAMSUID
PL_doswitches = FALSE; /* -s is insecure in suid */
/* PSz 13 Nov 03 But -s was caught elsewhere ... so unsetting it here is useless(?!) */
CopLINE_inc(PL_curcop);
- if (sv_gets(PL_linestr, PL_rsfp, 0) == NULL)
+ if (sv_gets(linestr_sv, PL_rsfp, 0) == NULL)
Perl_croak(aTHX_ "No #! line");
- linestr = SvPV_nolen_const(PL_linestr);
+ linestr = SvPV_nolen_const(linestr_sv);
/* required even on Sys V */
if (!*linestr || !linestr[1] || strnNE(linestr,"#!",2))
Perl_croak(aTHX_ "No #! line");
}
STATIC void
-S_find_beginning(pTHX)
+S_find_beginning(pTHX_ SV* linestr_sv)
{
dVAR;
register char *s;
/* Since the Mac OS does not honor #! arguments for us, we do it ourselves */
while (PL_doextract || gMacPerl_AlwaysExtract) {
- if ((s = sv_gets(PL_linestr, PL_rsfp, 0)) == NULL) {
+ if ((s = sv_gets(linestr_sv, PL_rsfp, 0)) == NULL) {
if (!gMacPerl_AlwaysExtract)
Perl_croak(aTHX_ "No Perl script found in input\n");
}
#else
while (PL_doextract) {
- if ((s = sv_gets(PL_linestr, PL_rsfp, 0)) == NULL)
+ if ((s = sv_gets(linestr_sv, PL_rsfp, 0)) == NULL)
Perl_croak(aTHX_ "No Perl script found in input\n");
#endif
s2 = s;
#endif
#if defined(PERL_IN_PERL_C) || defined(PERL_DECL_PROT)
-STATIC void S_find_beginning(pTHX);
+STATIC void S_find_beginning(pTHX_ SV* linestr_sv)
+ __attribute__nonnull__(pTHX_1);
+
STATIC void S_forbid_setid(pTHX_ const char flag, const int suidscript);
STATIC void S_incpush(pTHX_ const char *dir, bool addsubdirs, bool addoldvers, bool usesep, bool canrelocate);
STATIC void S_init_interp(pTHX);
STATIC void S_usage(pTHX_ const char *name)
__attribute__nonnull__(pTHX_1);
-STATIC void S_validate_suid(pTHX_ const char *validarg, const char *scriptname, int fdscript, int suidscript)
+STATIC void S_validate_suid(pTHX_ const char *validarg, const char *scriptname, int fdscript, int suidscript, SV* linestr_sv)
__attribute__nonnull__(pTHX_1)
- __attribute__nonnull__(pTHX_2);
+ __attribute__nonnull__(pTHX_2)
+ __attribute__nonnull__(pTHX_5);
# if defined(IAMSUID)
STATIC int S_fd_on_nosuid_fs(pTHX_ int fd);