* cygcheck.cc (load_cygwin): Free the cygwin dll after we're done with it.
This commit is contained in:
parent
904413e731
commit
34aa62035b
@ -1,3 +1,8 @@
|
|||||||
|
2008-07-27 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
|
* cygcheck.cc (load_cygwin): Free the cygwin dll after we're done with
|
||||||
|
it.
|
||||||
|
|
||||||
2008-07-25 Christopher Faylor <me+cygwin@cgf.cx>
|
2008-07-25 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
* mount.cc: Remove non-unix-like options (-x,-t,b) throughout.
|
* mount.cc: Remove non-unix-like options (-x,-t,b) throughout.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/* cygcheck.cc
|
/* cygcheck.cc
|
||||||
|
|
||||||
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
||||||
2006, 2007 Red Hat, Inc.
|
2006, 2007, 2008 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
@ -2020,35 +2020,36 @@ load_cygwin (int& argc, char **&argv)
|
|||||||
|
|
||||||
if (!(h = LoadLibrary ("cygwin1.dll")))
|
if (!(h = LoadLibrary ("cygwin1.dll")))
|
||||||
return;
|
return;
|
||||||
if (!(cygwin_internal = (DWORD (*) (int, ...)) GetProcAddress (h, "cygwin_internal")))
|
if ((cygwin_internal = (DWORD (*) (int, ...)) GetProcAddress (h, "cygwin_internal")))
|
||||||
return;
|
|
||||||
|
|
||||||
char **av = (char **) cygwin_internal (CW_ARGV);
|
|
||||||
if (av && ((DWORD) av != (DWORD) -1))
|
|
||||||
for (argc = 0, argv = av; *av; av++)
|
|
||||||
argc++;
|
|
||||||
|
|
||||||
char **envp = (char **) cygwin_internal (CW_ENVP);
|
|
||||||
if (envp && ((DWORD) envp != (DWORD) -1))
|
|
||||||
{
|
{
|
||||||
/* Store path and revert to this value, otherwise path gets overwritten
|
char **av = (char **) cygwin_internal (CW_ARGV);
|
||||||
by the POSIXy Cygwin variation, which breaks cygcheck.
|
if (av && ((DWORD) av != (DWORD) -1))
|
||||||
Another approach would be to use the Cygwin PATH and convert it to
|
for (argc = 0, argv = av; *av; av++)
|
||||||
Win32 again. */
|
argc++;
|
||||||
char *path = NULL;
|
|
||||||
char **env;
|
char **envp = (char **) cygwin_internal (CW_ENVP);
|
||||||
while (*(env = _environ))
|
if (envp && ((DWORD) envp != (DWORD) -1))
|
||||||
{
|
{
|
||||||
if (strncmp (*env, "PATH=", 5) == 0)
|
/* Store path and revert to this value, otherwise path gets overwritten
|
||||||
path = strdup (*env);
|
by the POSIXy Cygwin variation, which breaks cygcheck.
|
||||||
nuke (*env);
|
Another approach would be to use the Cygwin PATH and convert it to
|
||||||
|
Win32 again. */
|
||||||
|
char *path = NULL;
|
||||||
|
char **env;
|
||||||
|
while (*(env = _environ))
|
||||||
|
{
|
||||||
|
if (strncmp (*env, "PATH=", 5) == 0)
|
||||||
|
path = strdup (*env);
|
||||||
|
nuke (*env);
|
||||||
|
}
|
||||||
|
for (char **ev = envp; *ev; ev++)
|
||||||
|
if (strncmp (*ev, "PATH=", 5) != 0)
|
||||||
|
putenv (*ev);
|
||||||
|
if (path)
|
||||||
|
putenv (path);
|
||||||
}
|
}
|
||||||
for (char **ev = envp; *ev; ev++)
|
|
||||||
if (strncmp (*ev, "PATH=", 5) != 0)
|
|
||||||
putenv (*ev);
|
|
||||||
if (path)
|
|
||||||
putenv (path);
|
|
||||||
}
|
}
|
||||||
|
FreeLibrary (h);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user