Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-10-20 02:25:46 +0400
committerChristopher Faylor <me@cgf.cx>2005-10-20 02:25:46 +0400
commit0cdcb2345ad3e34fddcc8079d1c8d619a686ad06 (patch)
tree96c199f465a351463778717421e2d2dd59676b7a /winsup
parentfece95f7f38ff55b559dcd89c8be9b907bc256e0 (diff)
* sigproc.cc (child_info::sync): Move check for !wr_proc_pipe lower.
* spawn.cc (spawn_guts): Correct check for top-level process.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/sigproc.cc55
-rw-r--r--winsup/cygwin/spawn.cc2
2 files changed, 26 insertions, 31 deletions
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index ae44ad7f1..297c89375 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -819,41 +819,36 @@ bool
child_info::sync (pid_t pid, HANDLE& hProcess, DWORD howlong)
{
bool res;
- if (!subproc_ready && !myself->wr_proc_pipe)
- res = false;
+ HANDLE w4[2];
+ unsigned n = 0;
+ unsigned nsubproc_ready;
+
+ if (!subproc_ready)
+ nsubproc_ready = WAIT_OBJECT_0 + 3;
else
{
- HANDLE w4[2];
- unsigned n = 0;
- unsigned nsubproc_ready;
-
- if (!subproc_ready)
- nsubproc_ready = WAIT_OBJECT_0 + 3;
- else
- {
- w4[n++] = subproc_ready;
- nsubproc_ready = 0;
- }
- w4[n++] = hProcess;
+ w4[n++] = subproc_ready;
+ nsubproc_ready = 0;
+ }
+ w4[n++] = hProcess;
- sigproc_printf ("n %d, waiting for subproc_ready(%p) and child process(%p)", n, w4[0], w4[1]);
- DWORD x = WaitForMultipleObjects (n, w4, FALSE, howlong);
- x -= WAIT_OBJECT_0;
- if (x >= n)
- {
- system_printf ("wait failed, pid %d, %E", pid);
- res = false;
- }
- else
+ sigproc_printf ("n %d, waiting for subproc_ready(%p) and child process(%p)", n, w4[0], w4[1]);
+ DWORD x = WaitForMultipleObjects (n, w4, FALSE, howlong);
+ x -= WAIT_OBJECT_0;
+ if (x >= n)
+ {
+ system_printf ("wait failed, pid %d, %E", pid);
+ res = false;
+ }
+ else
+ {
+ if (type == _PROC_EXEC && x == nsubproc_ready && myself->wr_proc_pipe)
{
- if (type == _PROC_EXEC && x == nsubproc_ready)
- {
- ForceCloseHandle1 (hProcess, childhProcess);
- hProcess = NULL;
- }
- sigproc_printf ("process %d synchronized, WFMO returned %d", pid, x);
- res = true;
+ ForceCloseHandle1 (hProcess, childhProcess);
+ hProcess = NULL;
}
+ sigproc_printf ("process %d synchronized, WFMO returned %d", pid, x);
+ res = true;
}
return res;
}
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 269fb7491..b1cd0796a 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -815,7 +815,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
{
case _P_OVERLAY:
myself.hProcess = pi.hProcess;
- if (!synced && !myself->wr_proc_pipe)
+ if (synced && !myself->wr_proc_pipe)
{
extern bool is_toplevel_proc;
is_toplevel_proc = true;