summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/dll_init.cc
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/dll_init.cc')
-rw-r--r--winsup/cygwin/dll_init.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc
index 37f0297f1..122055722 100644
--- a/winsup/cygwin/dll_init.cc
+++ b/winsup/cygwin/dll_init.cc
@@ -76,7 +76,10 @@ dll::init ()
int ret = 1;
/* This should be a no-op. Why didn't we just import this variable? */
- *(p.envptr) = __cygwin_environ;
+ if (!p.envptr)
+ p.envptr = &__cygwin_environ;
+ else
+ *(p.envptr) = __cygwin_environ;
/* Don't run constructors or the "main" if we've forked. */
if (!in_forkee)