diff options
author | Christopher Faylor <me@cgf.cx> | 2006-03-22 03:20:28 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2006-03-22 03:20:28 +0000 |
commit | 76ef40d69f3651f01b3e2ffdeb470593d62e04b0 (patch) | |
tree | 22c20816ba49b39aae919e585cf2c88dc050bcf5 /winsup/cygwin/spawn.cc | |
parent | ce93dfe4150ab537bfc55b834f933145e18098c0 (diff) | |
download | cygnal-76ef40d69f3651f01b3e2ffdeb470593d62e04b0.tar.gz cygnal-76ef40d69f3651f01b3e2ffdeb470593d62e04b0.tar.bz2 cygnal-76ef40d69f3651f01b3e2ffdeb470593d62e04b0.zip |
* child_info.h (child_status): Fix typo which made it impossible to set
iscygwin.
(child_info::isstraced): Booleanize.
(child_info::iscygwin): Ditto.
* sigproc.cc (child_info::child_info): Minor cleanup of flag setting.
* spawn.cc (spawn_guts): Only close_all_files when we know the process has
started successfully.
* exceptions.cc (init_console_handler): Fix indentation.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r-- | winsup/cygwin/spawn.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 3a0209764..d61fb5984 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -777,8 +777,6 @@ loop: strace.execing = 1; myself.hProcess = hExeced = pi.hProcess; strcpy (myself->progname, real_path); // FIXME: race? - if (!looped) - close_all_files (true); sigproc_printf ("new process name %s", myself->progname); /* If wr_proc_pipe doesn't exist then this process was not started by a cygwin process. So, we need to wait around until the process we've just "execed" @@ -864,19 +862,25 @@ loop: myself->wr_proc_pipe_owner = GetCurrentProcessId (); myself->wr_proc_pipe = orig_wr_proc_pipe; } - if (ch.proc_retry (pi.hProcess) == 0) + DWORD res = ch.proc_retry (pi.hProcess); + if (!res) { looped++; goto loop; } + close_all_files (true); } - else if (!myself->wr_proc_pipe - && WaitForSingleObject (pi.hProcess, 0) == WAIT_TIMEOUT) + else { - extern bool is_toplevel_proc; - is_toplevel_proc = true; - myself.remember (false); - waitpid (myself->pid, &res, 0); + close_all_files (true); + if (!myself->wr_proc_pipe + && WaitForSingleObject (pi.hProcess, 0) == WAIT_TIMEOUT) + { + extern bool is_toplevel_proc; + is_toplevel_proc = true; + myself.remember (false); + waitpid (myself->pid, &res, 0); + } } myself.exit (EXITCODE_NOSET); break; |