summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-01-22 21:47:04 +0000
committerChristopher Faylor <me@cgf.cx>2005-01-22 21:47:04 +0000
commitc75e4f09ec9ba7349554ed434777994e51ead740 (patch)
tree358aa56713e84dc5b09b35aaf1de1b414d4d8d39
parent9a0b76dcedb80afc85f478e9ef6d11293fe581ed (diff)
downloadcygnal-c75e4f09ec9ba7349554ed434777994e51ead740.tar.gz
cygnal-c75e4f09ec9ba7349554ed434777994e51ead740.tar.bz2
cygnal-c75e4f09ec9ba7349554ed434777994e51ead740.zip
* spawn.cc (spawn_guts): Perform same "cd" as in pinfo::exit below to make sure
that a stub process does not keep the current working directory busy after the "execed" process has exited.
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/pinfo.cc18
-rw-r--r--winsup/cygwin/spawn.cc11
3 files changed, 24 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index b319f8ef2..967c83a61 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,11 @@
2005-01-22 Christopher Faylor <cgf@timesys.com>
+ * spawn.cc (spawn_guts): Perform same "cd" as in pinfo::exit below to
+ make sure that a stub process does not keep the current working
+ directory busy after the "execed" process has exited.
+
+2005-01-22 Christopher Faylor <cgf@timesys.com>
+
* pinfo.cc (pinfo::init): Move everything but the MapViewOfFileEx out
of the loop since trying multiple times to call CreateFileMapping
doesn't make much sense. Try to structure the loop a little better so
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 958d95030..754fd75a0 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -138,18 +138,20 @@ pinfo::exit (DWORD n)
fill_rusage (&r, hMainProc);
add_rusage (&self->rusage_self, &r);
- /* The below call could be moved down two lines, but I like to see consistent
+ /* The below call could be moved down two lines, but this provides consistent
output from strace and the overhead should be extremely negligible. */
maybe_set_exit_code_from_windows ();
+
+
if (n != EXITCODE_NOSET)
{
- /* Move to an innocuous location to avoid races with other processes
- that may want to manipulate the current directory before this process
- has completely exited. */
- SetCurrentDirectory ("c:\\");
- /* Shave a little time off by telling our parent that we have now
- exited. */
- self->alert_parent (0);
+ SetCurrentDirectory ("c:\\"); /* Move to an innocuous location to
+ avoid races with other processes
+ that may want to manipulate the
+ current directory before this process
+ has completely exited. */
+ self->alert_parent (0); /* Shave a little time by telling our
+ parent that we have now exited. */
}
int exitcode = self->exitcode;
release ();
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 0c26ab23d..68a49f4fe 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -809,9 +809,14 @@ spawn_guts (const char * prog_arg, const char *const *argv,
dup_proc_pipe essentially a no-op. */
if (myself->wr_proc_pipe)
{
- /* Make sure that we own wr_proc_pipe just in case we've been
- previously execed. */
- myself->sync_proc_pipe ();
+ myself->sync_proc_pipe (); /* Make sure that we own wr_proc_pipe
+ just in case we've been previously
+ execed. */
+ SetCurrentDirectory ("c:\\"); /* Move to an innocuous location to
+ avoid races with other processes
+ that may want to manipulate the
+ current directory before this process
+ has completely exited. */
(void) myself->dup_proc_pipe (pi.hProcess);
}
}