Should fix the infinite loop on a dynamic %ENV fetch
Nicholas Clark [Mon, 24 Nov 2003 20:07:29 +0000 (20:07 +0000)]
p4raw-id: //depot/perl@21782

hv.c

diff --git a/hv.c b/hv.c
index a39fdcd..39684b0 100644 (file)
--- a/hv.c
+++ b/hv.c
@@ -682,7 +682,8 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
        return entry;
     }
 #ifdef DYNAMIC_ENV_FETCH  /* %ENV lookup?  If so, try to fetch the value now */
-    if (SvRMAGICAL((SV*)hv) && mg_find((SV*)hv, PERL_MAGIC_env)) {
+    if (!(action & HV_FETCH_ISSTORE) 
+       && SvRMAGICAL((SV*)hv) && mg_find((SV*)hv, PERL_MAGIC_env)) {
        unsigned long len;
        char *env = PerlEnv_ENVgetenv_len(key,&len);
        if (env) {