* spawn.cc (find_exec): Stop relying on the ability to set retval to a fixed

path_conv buffer and set it on the fly instead.
This commit is contained in:
Christopher Faylor
2009-08-01 03:27:51 +00:00
parent f4a7842850
commit 5f297dc330
2 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,8 @@
2009-07-31 Christopher Faylor <me+cygwin@cgf.cx>
* spawn.cc (find_exec): Stop relying on the ability to set retval to a
fixed path_conv buffer and set it on the fly instead.
2009-07-30 Corinna Vinschen <corinna@vinschen.de> 2009-07-30 Corinna Vinschen <corinna@vinschen.de>
* path.h (cstrdup): Fix declaration. * path.h (cstrdup): Fix declaration.

View File

@ -109,7 +109,7 @@ find_exec (const char *name, path_conv& buf, const char *mywinenv,
{ {
const char *suffix = ""; const char *suffix = "";
debug_printf ("find_exec (%s)", name); debug_printf ("find_exec (%s)", name);
const char *retval = buf.get_win32 (); const char *retval;
tmp_pathbuf tp; tmp_pathbuf tp;
char *tmp = tp.c_get (); char *tmp = tp.c_get ();
const char *posix = (opt & FE_NATIVE) ? NULL : name; const char *posix = (opt & FE_NATIVE) ? NULL : name;
@ -129,6 +129,7 @@ find_exec (const char *name, path_conv& buf, const char *mywinenv,
strcpy (tmp + 2, name); strcpy (tmp + 2, name);
posix = tmp; posix = tmp;
} }
retval = buf.get_win32 ();
goto out; goto out;
} }
@ -198,10 +199,13 @@ find_exec (const char *name, path_conv& buf, const char *mywinenv,
Take the appropriate action based on null_if_not_found. */ Take the appropriate action based on null_if_not_found. */
if (opt & FE_NNF) if (opt & FE_NNF)
retval = NULL; retval = NULL;
else if (opt & FE_NATIVE) else if (!(opt & FE_NATIVE))
buf.check (name);
else
retval = name; retval = name;
else
{
buf.check (name);
retval = buf.get_win32 ();
}
out: out:
if (posix) if (posix)