* environ.cc (win_env::add_cache): Set the Windows environment variable
using wide chars to make sure native chars don't get scrambled. * environ.h (build_env): Fix formatting in declaration. * pinfo.cc (pinfo::status_exit): Handle STATUS_NO_MEMORY. Explain why.
This commit is contained in:
parent
592989d65c
commit
1a5dfe8ae0
|
@ -1,3 +1,10 @@
|
||||||
|
2013-05-24 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* environ.cc (win_env::add_cache): Set the Windows environment variable
|
||||||
|
using wide chars to make sure native chars don't get scrambled.
|
||||||
|
* environ.h (build_env): Fix formatting in declaration.
|
||||||
|
* pinfo.cc (pinfo::status_exit): Handle STATUS_NO_MEMORY. Explain why.
|
||||||
|
|
||||||
2013-05-24 Corinna Vinschen <corinna@vinschen.de>
|
2013-05-24 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* fork.cc (frok::parent): Always set CREATE_UNICODE_ENVIRONMENT flag.
|
* fork.cc (frok::parent): Always set CREATE_UNICODE_ENVIRONMENT flag.
|
||||||
|
|
|
@ -386,11 +386,11 @@ win_env::add_cache (const char *in_posix, const char *in_native)
|
||||||
MALLOC_CHECK;
|
MALLOC_CHECK;
|
||||||
if (immediate && cygwin_finished_initializing)
|
if (immediate && cygwin_finished_initializing)
|
||||||
{
|
{
|
||||||
char s[namelen];
|
wchar_t s[sys_mbstowcs (NULL, 0, native) + 1];
|
||||||
size_t n = namelen - 1;
|
sys_mbstowcs (s, sizeof s, native);
|
||||||
memcpy (s, name, n);
|
/* Hack. Relies on affected variables only having ASCII names. */
|
||||||
s[n] = '\0';
|
s[namelen - 1] = L'\0';
|
||||||
SetEnvironmentVariable (s, native + namelen);
|
SetEnvironmentVariableW (s, s + namelen);
|
||||||
}
|
}
|
||||||
debug_printf ("posix %s", posix);
|
debug_printf ("posix %s", posix);
|
||||||
debug_printf ("native %s", native);
|
debug_printf ("native %s", native);
|
||||||
|
|
|
@ -45,6 +45,6 @@ extern "C" char **__cygwin_environ, ***main_environ;
|
||||||
extern "C" char __stdcall **cur_environ ();
|
extern "C" char __stdcall **cur_environ ();
|
||||||
#endif
|
#endif
|
||||||
char ** __reg3 build_env (const char * const *envp, PWCHAR &envblock,
|
char ** __reg3 build_env (const char * const *envp, PWCHAR &envblock,
|
||||||
int &envc, bool need_envblock);
|
int &envc, bool need_envblock);
|
||||||
|
|
||||||
#define ENV_CVT -1
|
#define ENV_CVT -1
|
||||||
|
|
|
@ -144,6 +144,19 @@ pinfo::status_exit (DWORD x)
|
||||||
case STATUS_ILLEGAL_INSTRUCTION:
|
case STATUS_ILLEGAL_INSTRUCTION:
|
||||||
x = SIGILL;
|
x = SIGILL;
|
||||||
break;
|
break;
|
||||||
|
case STATUS_NO_MEMORY:
|
||||||
|
/* If the PATH environment variable is longer than about 30K and the full
|
||||||
|
Windows environment is > 32K, startup of an exec'ed process fails with
|
||||||
|
STATUS_NO_MEMORY. This happens with all Cygwin executables, as well
|
||||||
|
as, for instance, notepad, but it does not happen with CMD for some
|
||||||
|
reason. This occurs at a point where there's no return to the exec'ing
|
||||||
|
parent process, so we have to find some way to inform the user what
|
||||||
|
happened.
|
||||||
|
|
||||||
|
FIXME: For now, just return with SIGBUS set. Maybe it's better to add
|
||||||
|
a lengthy small_printf instead. */
|
||||||
|
x = SIGBUS;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
debug_printf ("*** STATUS_%y\n", x);
|
debug_printf ("*** STATUS_%y\n", x);
|
||||||
x = 127 << 8;
|
x = 127 << 8;
|
||||||
|
|
Loading…
Reference in New Issue