PERFORCE change 11389 for review

[email protected] (Chris Nandor) Mon, 16 Jul 2001 20:22:34 -0400
Newsgroups perl.perl5.changes.mac
Message-ID <p05100303b77935b5ab97@[10.0.1.177]>
Change 11389 by pudge@pudge-mobile on 2001/07/16 23:13:10

	Fix %ENV to be tainted [SF bug #231848, Thomas Wegner].
	Also add hack to get around missing setenv for PERL5DB.

Affected files ...

... //depot/maint-5.6/macperl/macos/macish.c#2 edit
... //depot/maint-5.6/macperl/macos/macish.h#2 edit

Differences ...

==== //depot/maint-5.6/macperl/macos/macish.c#2 (text) ====
Index: perl/macos/macish.c
--- perl/macos/macish.c.~1~	Mon Jul 16 17:15:05 2001
+++ perl/macos/macish.c	Mon Jul 16 17:15:05 2001
@@ -313,10 +313,13 @@
   /* Perform a dummy fetch as an lval to insure that the hash table is
    * set up.  Otherwise, the hv_store() will turn into a nullop */
   (void) hv_fetch(envhv,"DEFAULT",7,TRUE);
-  (void) hv_delete(envhv,"DEFAULT",7, G_DISCARD);
+  (void) hv_delete(envhv,"DEFAULT",7,G_DISCARD);
   for (env = environ; *env; ++env) {
+    SV *sv;
     len = strchr(*env, '=') - *env;
-    hv_store(envhv,*env,len,newSVpv(*env+len+1, 0),0);
+    sv = newSVpv(*env+len+1, 0);
+    SvTAINTED_on(sv);
+    hv_store(envhv,*env,len,sv,0);
   }
 }  /* end of prime_env_iter */
 
@@ -476,8 +479,10 @@
 {
 	int 	l = strlen(env);
 	char ** 	e;
-	Boolean	found;
-	
+
+	if (strEQ(env, "PERL5DB") && gMacPerl_Perl5DB)
+		return gMacPerl_Perl5DB;
+
 	for (e = environ; *e; ++e)
 		if (EqualEnv(env, *e))
 			return *e+l+1;
@@ -811,7 +816,9 @@
 }
 
 void
-Perl_my_setenv(pTHX_ char *nam, char *val)
+Perl_my_setenv(pTHX_ char *env, char *val)
 {
+	/* A hack just to get this darn thing working */
+	if (strEQ(env, "PERL5DB"))
+		gMacPerl_Perl5DB = val;
 }
-

==== //depot/maint-5.6/macperl/macos/macish.h#2 (text) ====
Index: perl/macos/macish.h
--- perl/macos/macish.h.~1~	Mon Jul 16 17:15:05 2001
+++ perl/macos/macish.h	Mon Jul 16 17:15:05 2001
@@ -74,6 +74,7 @@
 MP_EXT char	gMacPerl_AlwaysExtract		MP_INIT(false);
 MP_EXT char	gMacPerl_SyntaxError;
 MP_EXT char	gMacPerl_MustPrime;
+MP_EXT char *	gMacPerl_Perl5DB;
 MP_EXT char	gMacPerl_InModalDialog		MP_INIT(false);
 MP_EXT short	gMacPerl_OSErr;
 MP_EXT char 	gMacPerl_PseudoFileName[256];
End of Patch.