Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2018-06-06 18:45:55 +0300
committerCorinna Vinschen <corinna@vinschen.de>2018-06-07 10:42:36 +0300
commit9234545e3d84a873e1c1a6faff28cfb55320a248 (patch)
treedec699754881be8dcbaadc9a4d8d527765b130b9 /winsup/cygwin/pinfo.cc
parent1ecbb8d7b796b980db120d81f625d206c6a728da (diff)
Cygwin: Allow the environment pointer to be NULL
Following glibc, interpret this as meaning the environment is empty.
Diffstat (limited to 'winsup/cygwin/pinfo.cc')
-rw-r--r--winsup/cygwin/pinfo.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index e4eef8b3c..6b6986c9e 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -677,11 +677,12 @@ commune_process (void *arg)
sigproc_printf ("processing PICOM_ENVIRON");
unsigned n = 0;
char **env = cur_environ ();
- for (char **e = env; *e; e++)
- n += strlen (*e) + 1;
+ if (env)
+ for (char **e = env; *e; e++)
+ n += strlen (*e) + 1;
if (!WritePipeOverlapped (tothem, &n, sizeof n, &nr, 1000L))
sigproc_printf ("WritePipeOverlapped sizeof argv failed, %E");
- else
+ else if (env)
for (char **e = env; *e; e++)
if (!WritePipeOverlapped (tothem, *e, strlen (*e) + 1, &nr, 1000L))
{