* cygcheck.cc (load_cygwin): Avoid calling putenv with a NULL path.

This commit is contained in:
Christopher Faylor 2005-05-16 03:18:29 +00:00
parent 2c64ff5451
commit 41dcb6199c
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2005-05-15 Christopher Faylor <cgf@timesys.com>
* cygcheck.cc (load_cygwin): Avoid calling putenv with a NULL path.
2005-05-15 Corinna Vinschen <corinna@vinschen.de>
* cygcheck.cc (load_cygwin): Don't touch $PATH for now.

View File

@ -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);
}
}