From d4d63ebf22e0738e4a88f0ad53cb4e0e87ef92e3 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Tue, 21 Mar 2006 01:37:25 +0000 Subject: * 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. --- winsup/cygwin/spawn.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'winsup/cygwin/spawn.cc') 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++; -- cgit v1.2.3