diff options
author | Merijn Broeren <merijnb@iloquent.nl> | 2004-09-23 19:18:17 +0200 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-09-28 15:28:58 +0000 |
commit | 9b4eeda5ae692087a98457d63c818ddb127a1327 (patch) | |
tree | 25c5509f2f3eae3613bbd2c36973eb1f0a8eabaa | |
parent | 401441c0a1ebb6ac9c38237eb5daa1c00cea8bb6 (diff) | |
download | perl-9b4eeda5ae692087a98457d63c818ddb127a1327.tar.gz |
Patch for perl.c fixing an obscure environment bug
Message-ID: <20040923151817.GA15782@brugman.iloquent.nl>
p4raw-id: //depot/perl@23337
-rw-r--r-- | perl.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -4097,9 +4097,10 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register { environ[0] = Nullch; } - if (env) + if (env) { + char** origenv = environ; for (; *env; env++) { - if (!(s = strchr(*env,'='))) + if (!(s = strchr(*env,'=')) || s == *env) continue; #if defined(MSDOS) && !defined(DJGPP) *s = '\0'; @@ -4110,7 +4111,13 @@ S_init_postdump_symbols(pTHX_ register int argc, register char **argv, register (void)hv_store(hv, *env, s - *env, sv, 0); if (env != environ) mg_set(sv); + if (origenv != environ) { + /* realloc has shifted us */ + env = (env - origenv) + environ; + origenv = environ; + } } + } #endif /* USE_ENVIRON_ARRAY */ #endif /* !PERL_MICRO */ } |