diff options
author | Jan Dubois <jand@activestate.com> | 2007-01-04 04:37:48 -0800 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-01-05 07:49:03 +0000 |
commit | dc0472e9a2aeded945eee8b1bb412d40eff4fe15 (patch) | |
tree | 07c3f0b57bb2caed14e7753ca61d4f63c0b7e9cb /win32/perllib.c | |
parent | ae6198af6119a45e6060c5903f4eddcd7b0f9ade (diff) | |
download | perl-dc0472e9a2aeded945eee8b1bb412d40eff4fe15.tar.gz |
ANSIfy the PATH environment variable on Windows
Message-ID: <7coqp2pme3r30qaonticuv6c6licieg4cg@4ax.com>
p4raw-id: //depot/perl@29690
Diffstat (limited to 'win32/perllib.c')
-rw-r--r-- | win32/perllib.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/win32/perllib.c b/win32/perllib.c index 9b488d190f..cc46b304bd 100644 --- a/win32/perllib.c +++ b/win32/perllib.c @@ -211,6 +211,7 @@ RunPerl(int argc, char **argv, char **env) char szModuleName[MAX_PATH]; char *arg0 = argv[0]; char *ansi = NULL; + bool use_environ = (env == environ); osver.dwOSVersionInfoSize = sizeof(osver); GetVersionEx(&osver); @@ -245,6 +246,16 @@ RunPerl(int argc, char **argv, char **env) perl_construct(my_perl); PL_perl_destruct_level = 0; + /* PERL_SYS_INIT() may update the environment, e.g. via ansify_path(). + * This may reallocate the RTL environment block. Therefore we need + * to make sure that `env` continues to have the same value as `environ` + * if we have been called this way. If we have been called with any + * other value for `env` then all environment munging by PERL_SYS_INIT() + * will be lost again. + */ + if (use_environ) + env = environ; + exitstatus = perl_parse(my_perl, xs_init, argc, argv, env); if (!exitstatus) { #if defined(TOP_CLONE) && defined(USE_ITHREADS) /* XXXXXX testing */ |