* cygcheck.cc (load_cygwin): Duplicate argv list since it disappears when

cygwin1.dll is unloaded.
This commit is contained in:
Christopher Faylor 2008-08-04 15:30:06 +00:00
parent ef432bbddf
commit ea8432dfb1
2 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2008-08-04 Christopher Faylor <me+cygwin@cgf.cx>
* cygcheck.cc (load_cygwin): Duplicate argv list since it disappears
when cygwin1.dll is unloaded.
2008-07-30 Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
* Makefile.in: Link cygcheck with -lntdll even without mingw-zlib.

View File

@ -2024,8 +2024,15 @@ load_cygwin (int& argc, char **&argv)
{
char **av = (char **) cygwin_internal (CW_ARGV);
if (av && ((DWORD) av != (DWORD) -1))
for (argc = 0, argv = av; *av; av++)
argc++;
{
/* Copy cygwin's idea of the argument list into this Window application. */
for (argc = 0; av[argc]; argc++)
continue;
argv = (char **) calloc (argc + 1, sizeof (char *));
for (char **argvp = argv; *av; av++)
*argvp++ = strdup (*av);
}
char **envp = (char **) cygwin_internal (CW_ENVP);
if (envp && ((DWORD) envp != (DWORD) -1))