* autoload.cc (load_wsock32): Declare dummy function to force loading of
winsock. * fhandler.cc (fhandler_base::set_inheritance): Make debugging output more verbose. * fhandler_socket.cc (fhandler_socket::fixup_after_fork): Force loading of winsock32 if winsock2 not available. * net.cc (set_socket_inheritance): Use DuplicateHandle in all cases to set inheritance correctly. (fdsock): Use winsock2_active macro to determine when to set socket inheritance. Remove fdtab resource locking since this function should already be protected. (cygwin_accept): Simplify logic. Ensure that fdtab unlock is not called inappropriately. (cygwin_rcmd): Use fdtab locking. (cygwin_rresvport): Ditto. (cygwin_rexec): Ditto. * select.cc (peek_socket): Set errno appropriately if winsock select fails. * winsup.h: Declare check_pty_fds. * syscalls.cc (check_pty_fds): Rename from check_ttys_fds. Also check pty master. (setsid): Use check_pty_fds. * dtable.cc (dtable::dec_console_fds): Add check on pty fds.
This commit is contained in:
@ -1629,16 +1629,18 @@ fhandler_base::set_inheritance (HANDLE &h, int not_inheriting)
|
||||
void
|
||||
fhandler_base::fork_fixup (HANDLE parent, HANDLE &h, const char *name)
|
||||
{
|
||||
if (!get_close_on_exec ())
|
||||
HANDLE oh = h;
|
||||
if (/* !is_socket () && */ !get_close_on_exec ())
|
||||
debug_printf ("handle %p already opened", h);
|
||||
else if (!DuplicateHandle (parent, h, hMainProc, &h, 0, 0,
|
||||
else if (!DuplicateHandle (parent, h, hMainProc, &h, 0, !get_close_on_exec (),
|
||||
DUPLICATE_SAME_ACCESS))
|
||||
system_printf ("%s - %E, handle %s<%p>", get_name (), name, h);
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUGGING
|
||||
else
|
||||
{
|
||||
debug_printf ("%s success - oldh %p, h %p", get_name (), oh, h);
|
||||
ProtectHandle1 (h, name);
|
||||
setclexec_pid (h, 0);
|
||||
setclexec_pid (h, !get_close_on_exec ());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user