* 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:
Corinna Vinschen
2013-05-24 13:32:10 +00:00
parent 592989d65c
commit 1a5dfe8ae0
4 changed files with 26 additions and 6 deletions

View File

@@ -386,11 +386,11 @@ win_env::add_cache (const char *in_posix, const char *in_native)
MALLOC_CHECK;
if (immediate && cygwin_finished_initializing)
{
char s[namelen];
size_t n = namelen - 1;
memcpy (s, name, n);
s[n] = '\0';
SetEnvironmentVariable (s, native + namelen);
wchar_t s[sys_mbstowcs (NULL, 0, native) + 1];
sys_mbstowcs (s, sizeof s, native);
/* Hack. Relies on affected variables only having ASCII names. */
s[namelen - 1] = L'\0';
SetEnvironmentVariableW (s, s + namelen);
}
debug_printf ("posix %s", posix);
debug_printf ("native %s", native);