diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 43f374a63..fbe06db77 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,7 @@ +2005-05-15 Christopher Faylor + + * cygcheck.cc (load_cygwin): Avoid calling putenv with a NULL path. + 2005-05-15 Corinna Vinschen * cygcheck.cc (load_cygwin): Don't touch $PATH for now. diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc index afd43175c..fc334cee8 100644 --- a/winsup/utils/cygcheck.cc +++ b/winsup/utils/cygcheck.cc @@ -1466,12 +1466,15 @@ load_cygwin (int& argc, char **&argv) char *path = NULL; while (*_environ) { - if (!strncmp (*_environ, "PATH=", 5)) + if (strncmp (*_environ, "PATH=", 5) == 0) path = strdup (*_environ); nuke (*_environ); } for (char **ev = envp; *ev; ev++) - putenv (!strncmp (*ev, "PATH=", 5) ? path : *ev); + if (strncmp (*ev, "PATH=", 5) != 0) + putenv (*ev); + else if (path) + putenv (path); } }