4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-31 03:20:28 +08:00

* spawn.cc (spawn_guts): Close handles if we know that we will not be seeing a

sync event from the child.
This commit is contained in:
Christopher Faylor 2006-03-27 03:52:24 +00:00
parent ec54178c36
commit 8b9fb6fffd
2 changed files with 16 additions and 9 deletions

View File

@ -1,3 +1,8 @@
2006-03-26 Christopher Faylor <cgf@timesys.com>
* spawn.cc (spawn_guts): Close handles if we know that we will not be
seeing a sync event from the child.
2006-03-26 Christopher Faylor <cgf@timesys.com> 2006-03-26 Christopher Faylor <cgf@timesys.com>
* sigproc.cc (wait_sig): Move myself manipulation... * sigproc.cc (wait_sig): Move myself manipulation...

View File

@ -600,12 +600,12 @@ spawn_guts (const char * prog_arg, const char *const *argv,
si.wShowWindow = SW_HIDE; si.wShowWindow = SW_HIDE;
} }
int flags = GetPriorityClass (hMainProc); int c_flags = GetPriorityClass (hMainProc);
sigproc_printf ("priority class %d", flags); sigproc_printf ("priority class %d", c_flags);
flags |= CREATE_SEPARATE_WOW_VDM; c_flags |= CREATE_SEPARATE_WOW_VDM;
if (mode == _P_DETACH) if (mode == _P_DETACH)
flags |= DETACHED_PROCESS; c_flags |= DETACHED_PROCESS;
if (mode != _P_OVERLAY) if (mode != _P_OVERLAY)
myself->exec_sendsig = NULL; myself->exec_sendsig = NULL;
@ -642,7 +642,7 @@ spawn_guts (const char * prog_arg, const char *const *argv,
if (!newargv.win16_exe if (!newargv.win16_exe
&& (wincap.start_proc_suspended () || mode != _P_OVERLAY && (wincap.start_proc_suspended () || mode != _P_OVERLAY
|| cygheap->fdtab.need_fixup_before ())) || cygheap->fdtab.need_fixup_before ()))
flags |= CREATE_SUSPENDED; c_flags |= CREATE_SUSPENDED;
const char *runpath = null_app_name ? NULL : (const char *) real_path; const char *runpath = null_app_name ? NULL : (const char *) real_path;
@ -683,7 +683,7 @@ loop:
&sec_none_nih,/* process security attrs */ &sec_none_nih,/* process security attrs */
&sec_none_nih,/* thread security attrs */ &sec_none_nih,/* thread security attrs */
TRUE, /* inherit handles from parent */ TRUE, /* inherit handles from parent */
flags, c_flags,
envblock, /* environment */ envblock, /* environment */
0, /* use current drive/directory */ 0, /* use current drive/directory */
&si, &si,
@ -718,7 +718,7 @@ loop:
&sec_none_nih, /* process security attrs */ &sec_none_nih, /* process security attrs */
&sec_none_nih, /* thread security attrs */ &sec_none_nih, /* thread security attrs */
TRUE, /* inherit handles from parent */ TRUE, /* inherit handles from parent */
flags, c_flags,
envblock, /* environment */ envblock, /* environment */
0, /* use current drive/directory */ 0, /* use current drive/directory */
&si, &si,
@ -749,7 +749,7 @@ loop:
goto out; goto out;
} }
if (!(flags & CREATE_SUSPENDED)) if (!(c_flags & CREATE_SUSPENDED))
strace.write_childpid (ch, pi.dwProcessId); strace.write_childpid (ch, pi.dwProcessId);
/* Fixup the parent data structures if needed and resume the child's /* Fixup the parent data structures if needed and resume the child's
@ -801,6 +801,8 @@ loop:
orig_wr_proc_pipe = myself->dup_proc_pipe (pi.hProcess); orig_wr_proc_pipe = myself->dup_proc_pipe (pi.hProcess);
} }
pid = myself->pid; pid = myself->pid;
if (!ch.iscygwin ())
close_all_files ();
} }
else else
{ {
@ -840,7 +842,7 @@ loop:
} }
/* Start the child running */ /* Start the child running */
if (flags & CREATE_SUSPENDED) if (c_flags & CREATE_SUSPENDED)
{ {
ResumeThread (pi.hThread); ResumeThread (pi.hThread);
strace.write_childpid (ch, pi.dwProcessId); strace.write_childpid (ch, pi.dwProcessId);