* configure.in: Remove NEWVFORK default.
* configure: Regenerate. * dcrt0.cc: Conditionalize vfork stuff throughout. * dtable.cc: Ditto. * perthread.h: Ditto. * pipe.cc (fhandler_pipe::close): Ditto. * spawn.cc (spawnve): Ditto. * syscalls.cc (setsid): Ditto. * exceptions.cc (sigpacket::process): Use macro to refer to vfork pid. * debug.cc (verify_handle): Define new function. * debug.h (VerifyHandle): Define new macro. (verify_handle): Declare new function * fhandler.cc (fhandler_base::dup): Verify that dup'ed handle is not supposed to be in use. (fhandler_base::set_inheritance): Ditto. (fhandler_base::fork_fixup): Ditto. * fhandler_socket.cc (fhandler_socket::dup): Ditto. * fhandler_tty.cc (fhandler_tty_slave::open): Ditto. * net.cc (set_socket_inheritance): Ditto. * pinfo.cc (pinfo_fixup_after_exec): Ditto. * sigproc.cc (proc_subproc): Ditto. (sig_send): Ditto. * spawn.cc (spawn_guts): Ditto. * thread.cc (pthread::init_mainthread): Ditto. * pipe.cc (fhandler_pipe::close): Close read_state with ForceCloseHandle since it was protected. (fhandler_pipe::fixup_after_exec): Protect read_state handle. (fhandler_pipe::dup): Correctly close open handles on error condition. Verify that dup'ed handle is not supposed to be in use. (fhandler_pipe::create): Protect read_state.
This commit is contained in:
@ -320,6 +320,7 @@ proc_subproc (DWORD what, DWORD val)
|
||||
if (!DuplicateHandle (hMainProc, hMainProc, vchild->hProcess, &vchild->ppid_handle,
|
||||
SYNCHRONIZE | PROCESS_DUP_HANDLE, TRUE, 0))
|
||||
system_printf ("Couldn't duplicate my handle<%p> for pid %d, %E", hMainProc, vchild->pid);
|
||||
VerifyHandle (vchild->ppid_handle);
|
||||
vchild->ppid = myself->pid;
|
||||
vchild->uid = myself->uid;
|
||||
vchild->gid = myself->gid;
|
||||
@ -716,17 +717,19 @@ sig_send (_pinfo *p, siginfo_t& si, _threadinfo *tls)
|
||||
__seterrno ();
|
||||
goto out;
|
||||
}
|
||||
VerifyHandle (hp);
|
||||
for (int i = 0; !p->sendsig && i < 10000; i++)
|
||||
low_priority_sleep (0);
|
||||
if (!DuplicateHandle (hp, p->sendsig, hMainProc, &sendsig, false, 0,
|
||||
DUPLICATE_SAME_ACCESS) || !sendsig)
|
||||
{
|
||||
CloseHandle (hp);
|
||||
sigproc_printf ("DuplicateHandle failed, %E");
|
||||
__seterrno ();
|
||||
goto out;
|
||||
}
|
||||
CloseHandle (hp);
|
||||
pack.wakeup = NULL;
|
||||
VerifyHandle (sendsig);
|
||||
}
|
||||
|
||||
sigproc_printf ("sendsig %p, pid %d, signal %d, its_me %d", sendsig, p->pid, si.si_signo, its_me);
|
||||
|
Reference in New Issue
Block a user