* syscalls.cc (internal_setlocale): Only convert $PATH if there is a
$PATH.
This commit is contained in:
parent
9d52f5c21c
commit
8d648dc555
|
@ -1,3 +1,8 @@
|
||||||
|
2009-10-19 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* syscalls.cc (internal_setlocale): Only convert $PATH if there is a
|
||||||
|
$PATH.
|
||||||
|
|
||||||
2009-10-19 Corinna Vinschen <corinna@vinschen.de>
|
2009-10-19 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* spawn.cc (av::fixup): Treat non-readable, but executable files as
|
* spawn.cc (av::fixup): Treat non-readable, but executable files as
|
||||||
|
|
|
@ -4242,13 +4242,17 @@ internal_setlocale ()
|
||||||
/* FIXME: It could be necessary to convert the entire environment,
|
/* FIXME: It could be necessary to convert the entire environment,
|
||||||
not just PATH. */
|
not just PATH. */
|
||||||
tmp_pathbuf tp;
|
tmp_pathbuf tp;
|
||||||
wchar_t *w_path, *w_cwd;
|
char *path = getenv ("PATH");
|
||||||
|
wchar_t *w_path = NULL, *w_cwd;
|
||||||
|
|
||||||
debug_printf ("Cygwin charset changed from %s to %s",
|
debug_printf ("Cygwin charset changed from %s to %s",
|
||||||
cygheap->locale.charset, __locale_charset ());
|
cygheap->locale.charset, __locale_charset ());
|
||||||
/* Fetch CWD and PATH and convert to wchar_t in previous charset. */
|
/* Fetch PATH and CWD and convert to wchar_t in previous charset. */
|
||||||
w_path = tp.w_get ();
|
if (path && *path) /* $PATH can be potentially unset. */
|
||||||
sys_mbstowcs (w_path, 32768, getenv ("PATH"));
|
{
|
||||||
|
w_path = tp.w_get ();
|
||||||
|
sys_mbstowcs (w_path, 32768, path);
|
||||||
|
}
|
||||||
w_cwd = tp.w_get ();
|
w_cwd = tp.w_get ();
|
||||||
cwdstuff::cwd_lock.acquire ();
|
cwdstuff::cwd_lock.acquire ();
|
||||||
sys_mbstowcs (w_cwd, 32768, cygheap->cwd.get_posix ());
|
sys_mbstowcs (w_cwd, 32768, cygheap->cwd.get_posix ());
|
||||||
|
@ -4259,9 +4263,12 @@ internal_setlocale ()
|
||||||
/* Restore CWD and PATH in new charset. */
|
/* Restore CWD and PATH in new charset. */
|
||||||
cygheap->cwd.reset_posix (w_cwd);
|
cygheap->cwd.reset_posix (w_cwd);
|
||||||
cwdstuff::cwd_lock.release ();
|
cwdstuff::cwd_lock.release ();
|
||||||
char *c_path = tp.c_get ();
|
if (w_path)
|
||||||
sys_wcstombs (c_path, 32768, w_path);
|
{
|
||||||
setenv ("PATH", c_path, 1);
|
char *c_path = tp.c_get ();
|
||||||
|
sys_wcstombs (c_path, 32768, w_path);
|
||||||
|
setenv ("PATH", c_path, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called from dll_crt0_1, before calling the application's main().
|
/* Called from dll_crt0_1, before calling the application's main().
|
||||||
|
|
Loading…
Reference in New Issue