aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/environ.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-09-16 14:52:32 +0000
committerChristopher Faylor <me@cgf.cx>2005-09-16 14:52:32 +0000
commit4dc2cfe588b87a2eab01f1a0b8369832f53b61c3 (patch)
tree6f9f854d8f3335d9ce20a572b35aaec40f19aa74 /winsup/cygwin/environ.cc
parent882dfbf776f69b39aeb5f444525191327fb3a3d9 (diff)
downloadnewlib-4dc2cfe588b87a2eab01f1a0b8369832f53b61c3.zip
newlib-4dc2cfe588b87a2eab01f1a0b8369832f53b61c3.tar.gz
newlib-4dc2cfe588b87a2eab01f1a0b8369832f53b61c3.tar.bz2
* environ.cc (environ_init): Issue an error if GetEnvironmentStrings fails and
return.
Diffstat (limited to 'winsup/cygwin/environ.cc')
-rw-r--r--winsup/cygwin/environ.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 37d950e..4029cd6 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -752,7 +752,13 @@ environ_init (char **envp, int envc)
/* Allocate space for environment + trailing NULL + CYGWIN env. */
lastenviron = envp = (char **) malloc ((4 + (envc = 100)) * sizeof (char *));
+
rawenv = GetEnvironmentStrings ();
+ if (!rawenv)
+ {
+ system_printf ("GetEnvironmentStrings returned NULL, %E");
+ return;
+ }
/* Current directory information is recorded as variables of the
form "=X:=X:\foo\bar; these must be changed into something legal