aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2006-12-18 22:04:20 +0000
committerCorinna Vinschen <corinna@vinschen.de>2006-12-18 22:04:20 +0000
commit0e15045861507b190c84461ec6a9d91abdd4f410 (patch)
tree562f086e4e2d623378e25c96ee9403ec0ebaf637 /winsup
parentf9b55ef15e0e0dd33d055020741904e81b48f682 (diff)
downloadnewlib-0e15045861507b190c84461ec6a9d91abdd4f410.zip
newlib-0e15045861507b190c84461ec6a9d91abdd4f410.tar.gz
newlib-0e15045861507b190c84461ec6a9d91abdd4f410.tar.bz2
Fix erroneous merge from HEAD.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/pinfo.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 5ec63be..9f93d5f 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -124,6 +124,16 @@ pinfo::maybe_set_exit_code_from_windows ()
}
void
+pinfo::zap_cwd ()
+{
+ extern char windows_system_directory[];
+ /* Move to an innocuous location to avoid a race with other processes
+ that may want to manipulate the current directory before this
+ process has completely exited. */
+ SetCurrentDirectory (windows_system_directory);
+}
+
+void
pinfo::exit (DWORD n)
{
minimal_printf ("winpid %d, exit %d", GetCurrentProcessId (), n);
@@ -139,6 +149,7 @@ pinfo::exit (DWORD n)
}
sigproc_terminate (ES_FINAL);
+ zap_cwd ();
/* FIXME: There is a potential race between an execed process and its
parent here. I hated to add a mutex just for that, though. */