Make doing_taint() always available (though not
Jarkko Hietaniemi [Fri, 27 Jun 2003 07:39:58 +0000 (07:39 +0000)]
part of the public API).

p4raw-id: //depot/perl@19862

embed.fnc
embed.h
perl.c
proto.h

index 954f358..7ffdef7 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -45,6 +45,7 @@ Anod  |void   |perl_free      |PerlInterpreter* interp
 Anod   |int    |perl_run       |PerlInterpreter* interp
 Anod   |int    |perl_parse     |PerlInterpreter* interp|XSINIT_t xsinit \
                                |int argc|char** argv|char** env
+np     |int    |doing_taint    |int argc|char** argv|char** env
 #if defined(USE_ITHREADS)
 Anod   |PerlInterpreter*|perl_clone|PerlInterpreter* interp, UV flags
 #  if defined(PERL_IMPLICIT_SYS)
diff --git a/embed.h b/embed.h
index 14b5343..b89d173 100644 (file)
--- a/embed.h
+++ b/embed.h
@@ -29,6 +29,9 @@
 
 #if defined(PERL_IMPLICIT_SYS)
 #endif
+#ifdef PERL_CORE
+#define doing_taint            Perl_doing_taint
+#endif
 #if defined(USE_ITHREADS)
 #  if defined(PERL_IMPLICIT_SYS)
 #  endif
 
 #if defined(PERL_IMPLICIT_SYS)
 #endif
+#ifdef PERL_CORE
+#define doing_taint            Perl_doing_taint
+#endif
 #if defined(USE_ITHREADS)
 #  if defined(PERL_IMPLICIT_SYS)
 #  endif
diff --git a/perl.c b/perl.c
index a4487fb..b6231a4 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -3327,8 +3327,9 @@ S_init_ids(pTHX)
     PL_tainting |= (PL_uid && (PL_euid != PL_uid || PL_egid != PL_gid));
 }
 
-#ifdef MYMALLOC
-/* This is used very early in the lifetime of the program. */
+/* This is used very early in the lifetime of the program,
+ * before even the options are parsed, so PL_tainting has
+ * not been initialized properly.*/
 int
 Perl_doing_taint(int argc, char *argv[], char *envp[])
 {
@@ -3351,7 +3352,6 @@ Perl_doing_taint(int argc, char *argv[], char *envp[])
        return 1;
     return 0;
 }
-#endif
 
 STATIC void
 S_forbid_setid(pTHX_ char *s)
diff --git a/proto.h b/proto.h
index fee6d0a..3c3776d 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -26,6 +26,7 @@ PERL_CALLCONV int     perl_destruct(PerlInterpreter* interp);
 PERL_CALLCONV void     perl_free(PerlInterpreter* interp);
 PERL_CALLCONV int      perl_run(PerlInterpreter* interp);
 PERL_CALLCONV int      perl_parse(PerlInterpreter* interp, XSINIT_t xsinit, int argc, char** argv, char** env);
+PERL_CALLCONV int      Perl_doing_taint(int argc, char** argv, char** env);
 #if defined(USE_ITHREADS)
 PERL_CALLCONV PerlInterpreter* perl_clone(PerlInterpreter* interp, UV flags);
 #  if defined(PERL_IMPLICIT_SYS)