* pinfo.cc (_pinfo::dup_proc_pipe): Can't close proc pipe when execing or we
will suffer an exit code race.
This commit is contained in:
parent
dbdbed283b
commit
abb13199ba
|
@ -1,3 +1,8 @@
|
||||||
|
2005-01-03 Christopher Faylor <cgf@timesys.com>
|
||||||
|
|
||||||
|
* pinfo.cc (_pinfo::dup_proc_pipe): Can't close proc pipe when execing
|
||||||
|
or we will suffer an exit code race.
|
||||||
|
|
||||||
2005-01-03 Corinna Vinschen <corinna@vinschen.de>
|
2005-01-03 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* signal.cc (abort): Call _GLOBAL_REENT's __cleanup.
|
* signal.cc (abort): Call _GLOBAL_REENT's __cleanup.
|
||||||
|
|
|
@ -764,9 +764,14 @@ proc_waiter (void *arg)
|
||||||
bool
|
bool
|
||||||
_pinfo::dup_proc_pipe (HANDLE hProcess)
|
_pinfo::dup_proc_pipe (HANDLE hProcess)
|
||||||
{
|
{
|
||||||
|
DWORD flags = DUPLICATE_SAME_ACCESS;
|
||||||
|
/* Grr. Can't set DUPLICATE_CLOSE_SOURCE for exec case because we could be
|
||||||
|
execing a non-cygwin process and we need to set the exit value before the
|
||||||
|
parent sees it. */
|
||||||
|
if (this != myself)
|
||||||
|
flags |= DUPLICATE_CLOSE_SOURCE;
|
||||||
bool res = DuplicateHandle (hMainProc, wr_proc_pipe, hProcess, &wr_proc_pipe,
|
bool res = DuplicateHandle (hMainProc, wr_proc_pipe, hProcess, &wr_proc_pipe,
|
||||||
0, FALSE,
|
0, FALSE, flags);
|
||||||
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
|
|
||||||
if (!res)
|
if (!res)
|
||||||
sigproc_printf ("DuplicateHandle failed, pid %d, hProcess %p, %E", pid, hProcess);
|
sigproc_printf ("DuplicateHandle failed, pid %d, hProcess %p, %E", pid, hProcess);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue