summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/spawn.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2006-03-21 01:37:25 +0000
committerChristopher Faylor <me@cgf.cx>2006-03-21 01:37:25 +0000
commitd4d63ebf22e0738e4a88f0ad53cb4e0e87ef92e3 (patch)
treef0a81671dce7a0901b26b958fff4a329b000c8d3 /winsup/cygwin/spawn.cc
parent3078fb4f360e44b436bafcd9e7c51f26792e34b4 (diff)
downloadcygnal-d4d63ebf22e0738e4a88f0ad53cb4e0e87ef92e3.tar.gz
cygnal-d4d63ebf22e0738e4a88f0ad53cb4e0e87ef92e3.tar.bz2
cygnal-d4d63ebf22e0738e4a88f0ad53cb4e0e87ef92e3.zip
* dcrt0.cc (dll_crt0_0): Call SetErrorMode earlier.
* pinfo.cc (_pinfo::dup_proc_pipe): Reset wr_proc_pipe on failure. Return previous pipe handle. * pinfo.h (_pinfo::dup_proc_pipe): Reflect change to return value. * spawn.cc (spawn_guts): Restore previous proc pipe on retry or if process exits before synchronization.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r--winsup/cygwin/spawn.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 4b48de59e..3a0209764 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -445,6 +445,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
bool null_app_name = false;
STARTUPINFO si = {0, NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL};
int looped = 0;
+ HANDLE orig_wr_proc_pipe = NULL;
myfault efault;
if (efault.faulted ())
@@ -795,11 +796,11 @@ loop:
if (!looped)
{
myself->sync_proc_pipe (); /* Make sure that we own wr_proc_pipe
- just in case we've been previously
- execed. */
+ just in case we've been previously
+ execed. */
myself.zap_cwd ();
}
- myself->dup_proc_pipe (pi.hProcess);
+ orig_wr_proc_pipe = myself->dup_proc_pipe (pi.hProcess);
}
pid = myself->pid;
}
@@ -858,6 +859,11 @@ loop:
myself.hProcess = pi.hProcess;
if (!synced)
{
+ if (orig_wr_proc_pipe)
+ {
+ myself->wr_proc_pipe_owner = GetCurrentProcessId ();
+ myself->wr_proc_pipe = orig_wr_proc_pipe;
+ }
if (ch.proc_retry (pi.hProcess) == 0)
{
looped++;