* fhandler.cc (fhandler_base::fork_fixup): Protect dup'ed handle and record it

as non-inheritable for debugging purposes in case there is a subsequent fork or
exec.
* fhandler_tty.cc (fhandler_tty_common::fixup_after_fork): Allow fork_fixup to
call ProtecHandle.
This commit is contained in:
Christopher Faylor
2001-10-06 01:04:24 +00:00
parent 3cf6936e3b
commit a448b8cf34
3 changed files with 19 additions and 10 deletions

View File

@@ -1624,9 +1624,16 @@ fhandler_base::fork_fixup (HANDLE parent, HANDLE &h, const char *name)
{
if (!get_close_on_exec ())
debug_printf ("handle %p already opened", h);
else if (!DuplicateHandle (parent, h, hMainProc, &h, 0, !get_close_on_exec (),
DUPLICATE_SAME_ACCESS))
else if (!DuplicateHandle (parent, h, hMainProc, &h, 0, 0,
DUPLICATE_SAME_ACCESS))
system_printf ("%s - %E, handle %s<%p>", get_name (), name, h);
#ifdef DEBUG
else
{
ProtectHandle1 (h, name);
setclexec_pid (h, 0);
}
#endif
}
void