summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Konojacki <me@xenu.pl>2022-04-19 16:41:23 +0200
committerxenu <me@xenu.pl>2022-05-29 00:54:10 +0200
commit66673af5955ecc69305b0baad0a8fb6162312409 (patch)
treeff6230ba36209f14b77f4aa92dbaa563a829e2b8
parent471430840e1f4a41f79744508c22d7569e6ed3f8 (diff)
downloadperl-66673af5955ecc69305b0baad0a8fb6162312409.tar.gz
make PL_origenviron global
The purpose of PL_origenviron is to preserve the earliest known value of environ, which is a global. All interpreters should share it.
-rw-r--r--embedvar.h1
-rw-r--r--intrpvar.h1
-rw-r--r--perl.c3
-rw-r--r--perlvars.h1
-rw-r--r--sv.c1
5 files changed, 3 insertions, 4 deletions
diff --git a/embedvar.h b/embedvar.h
index 11989eb894..da874d457c 100644
--- a/embedvar.h
+++ b/embedvar.h
@@ -214,7 +214,6 @@
#define PL_origalen (vTHX->Iorigalen)
#define PL_origargc (vTHX->Iorigargc)
#define PL_origargv (vTHX->Iorigargv)
-#define PL_origenviron (vTHX->Iorigenviron)
#define PL_origfilename (vTHX->Iorigfilename)
#define PL_ors_sv (vTHX->Iors_sv)
#define PL_osname (vTHX->Iosname)
diff --git a/intrpvar.h b/intrpvar.h
index 94ddbf672b..2ff67a8e0f 100644
--- a/intrpvar.h
+++ b/intrpvar.h
@@ -700,7 +700,6 @@ PERLVARI(I, cop_seqmax, U32, PERL_COP_SEQMAX) /* statement sequence number */
PERLVARI(I, evalseq, U32, 0) /* eval sequence number */
PERLVAR(I, origalen, U32)
-PERLVAR(I, origenviron, char **)
#ifdef PERL_USES_PL_PIDSTATUS
PERLVAR(I, pidstatus, HV *) /* pid-to-status mappings for waitpid */
#endif
diff --git a/perl.c b/perl.c
index 9bd4b3ed26..b3e16c0eaf 100644
--- a/perl.c
+++ b/perl.c
@@ -360,7 +360,8 @@ perl_construct(pTHXx)
#ifndef PERL_MICRO
# ifdef USE_ENVIRON_ARRAY
- PL_origenviron = environ;
+ if (!PL_origenviron)
+ PL_origenviron = environ;
# endif
#endif
diff --git a/perlvars.h b/perlvars.h
index 9a2c94f4c7..ae52cbe00c 100644
--- a/perlvars.h
+++ b/perlvars.h
@@ -303,3 +303,4 @@ PERLVARI(G, strategy_pipe, int, 0) /* doio.c */
PERLVARI(G, strategy_socketpair, int, 0) /* doio.c */
PERLVARI(G, my_environ, char **, NULL)
+PERLVARI(G, origenviron, char **, NULL)
diff --git a/sv.c b/sv.c
index bff92f610d..faea851c98 100644
--- a/sv.c
+++ b/sv.c
@@ -15548,7 +15548,6 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
PL_nomemok = proto_perl->Inomemok;
PL_an = proto_perl->Ian;
PL_evalseq = proto_perl->Ievalseq;
- PL_origenviron = proto_perl->Iorigenviron; /* XXX not quite right */
PL_origalen = proto_perl->Iorigalen;
PL_sighandlerp = proto_perl->Isighandlerp;