From 4dc2cfe588b87a2eab01f1a0b8369832f53b61c3 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 16 Sep 2005 14:52:32 +0000 Subject: * environ.cc (environ_init): Issue an error if GetEnvironmentStrings fails and return. --- winsup/cygwin/environ.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'winsup/cygwin/environ.cc') 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 -- cgit v1.1