summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/syscalls.cc
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-09-21 19:29:16 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-09-21 19:29:16 +0000
commitee42ccd3a2c71ddf73a7b58cdf7ce8afdd0da5dd (patch)
treeae7ba1374266f5e3060a65a0c66a6766de54319a /winsup/cygwin/syscalls.cc
parent92763ad9ba0498994c6d466c7e58ba755560183a (diff)
downloadcygnal-ee42ccd3a2c71ddf73a7b58cdf7ce8afdd0da5dd.tar.gz
cygnal-ee42ccd3a2c71ddf73a7b58cdf7ce8afdd0da5dd.tar.bz2
cygnal-ee42ccd3a2c71ddf73a7b58cdf7ce8afdd0da5dd.zip
* cygheap.h (cwdstuff::get_posix): Convert to const inline method just
returning pointer to posix path. (cwdstuff::reset_posix): Convert to non-inline method taking a wchar_t pointer. * path.cc (cwdstuff::set): Revert change from 2009-05-13. Set posix to valid incoming path again. (cwdstuff::reset_posix): New implementation setting posix path from incoming wchar_t path. Explain usage. (cwdstuff::get_posix): Drop implementation. (cwdstuff::get): Drop special case to handle empty posix path. * syscalls.cc (internal_setlocale): Store old posix cwd as wide char path. Restore posix cwd using new charset. Explain why.
Diffstat (limited to 'winsup/cygwin/syscalls.cc')
-rw-r--r--winsup/cygwin/syscalls.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index e86163886..a436afd52 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -4063,6 +4063,16 @@ unlinkat (int dirfd, const char *pathname, int flags)
static char *
internal_setlocale (char *ret)
{
+ tmp_pathbuf tp;
+
+ /* Each setlocale potentially changes the multibyte representation
+ of the CWD. Therefore we have to reevaluate the CWD's posix path and
+ store in the new charset. */
+ /* FIXME: Other buffered paths might be affected as well. */
+ wchar_t *w_cwd = tp.w_get ();
+ cwdstuff::cwd_lock.acquire ();
+ sys_mbstowcs (w_cwd, 32768, cygheap->cwd.get_posix ());
+
if (*__locale_charset () == 'A')
{
cygheap->locale.mbtowc = __utf8_mbtowc;
@@ -4097,11 +4107,10 @@ internal_setlocale (char *ret)
cygheap->locale.wctomb = __wctomb;
}
strcpy (cygheap->locale.charset, __locale_charset ());
- /* Each setlocale potentially changes the multibyte representation
- of the CWD. Therefore we have to reset the CWD's posix path and
- reevaluate the next time it's used. */
- /* FIXME: Other buffered paths might be affected as well. */
- cygheap->cwd.reset_posix ();
+
+ /* See above. */
+ cygheap->cwd.reset_posix (w_cwd);
+ cwdstuff::cwd_lock.release ();
return ret;
}