diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2007-08-16 14:30:53 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2007-08-16 14:30:53 +0000 |
commit | dec9daad4a6b6f5f705f8e637d21e9e035d08218 (patch) | |
tree | e9d1604b26fa8286c35314d4430a8094d5616a62 /winsup/cygwin/path.cc | |
parent | bd61a7f7b922dc8b14fc5cc395d0b5503673b219 (diff) | |
download | cygnal-dec9daad4a6b6f5f705f8e637d21e9e035d08218.tar.gz cygnal-dec9daad4a6b6f5f705f8e637d21e9e035d08218.tar.bz2 cygnal-dec9daad4a6b6f5f705f8e637d21e9e035d08218.zip |
* ntdll.h (RtlAcquirePebLock): Declare.
(RtlReleasePebLock): Declare.
* path.cc (cwdstuff::set): Change PEB only while it's locked.
Diffstat (limited to 'winsup/cygwin/path.cc')
-rw-r--r-- | winsup/cygwin/path.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 5a0bc903b..a8b64da98 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -4329,6 +4329,7 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit) strcpy (as.Buffer + len, "\\"); ++as.Length; } + RtlAcquirePebLock (); if (current_codepage == ansi_cp) RtlAnsiStringToUnicodeString ( &get_user_proc_parms ()->CurrentDirectoryName, @@ -4339,11 +4340,9 @@ cwdstuff::set (const char *win32_cwd, const char *posix_cwd, bool doit) &as, FALSE); PHANDLE phdl = &get_user_proc_parms ()->CurrentDirectoryHandle; if (*phdl) - { - HANDLE old_h = *phdl; - *phdl = h; - CloseHandle (old_h); - } + CloseHandle (*phdl); + *phdl = h; + RtlReleasePebLock (); } } /* If there is no win32 path or it has the form c:xxx, get the value */ |