Also mod_perl has some interesting commentary:
/* Force the environment to be copied out of its original location
above argv[]. This fixes a crash caused when a module called putenv()
before any Perl modified the environment - environ would change to a
new value, and the check in my_setenv() to duplicate the environment
would fail, and then setting some environment value which had a previous
value would cause perl to try to free() something from the original env.
This crashed free(). */
my_setenv("MODPERL_ENV_FIXUP", "0");
my_setenv("MODPERL_ENV_FIXUP", NULL);
FWIW, perl's environment handling seems to be somewhat controversial. Possibly related:
http:// bugs.debian. org/cgi- bin/bugreport. cgi?bug= 142523, for which the upstream report is here: http:// rt.perl. org/rt3/ Public/ Bug/Display. html?id= 1170
Also mod_perl has some interesting commentary: setenv( "MODPERL_ ENV_FIXUP" , "0"); setenv( "MODPERL_ ENV_FIXUP" , NULL);
/* Force the environment to be copied out of its original location
above argv[]. This fixes a crash caused when a module called putenv()
before any Perl modified the environment - environ would change to a
new value, and the check in my_setenv() to duplicate the environment
would fail, and then setting some environment value which had a previous
value would cause perl to try to free() something from the original env.
This crashed free(). */
my_
my_
CC'ing perl maintainer for possible comments.