* fhandler_disk_file.cc (fhandler_disk_file::opendir): Check descriptor
created by cygheap_fdnew constructor. * fhandler_virtual.cc (fhandler_virtual::opendir): Ditto. * fhandler_socket.cc (fhandler_socket::accept): Ditto and move creation of file descriptor behind blocking OS call. * net.cc (cygwin_socket): Ditto. (cygwin_rcmd): Ditto. (cygwin_rresvport): Ditto. (cygwin_rexec): Ditto. (socketpair): Ditto.
This commit is contained in:
@@ -484,7 +484,6 @@ fhandler_socket::accept (struct sockaddr *peer, int *len)
|
||||
WSAEVENT ev[2] = { WSA_INVALID_EVENT, signal_arrived };
|
||||
BOOL secret_check_failed = FALSE;
|
||||
BOOL in_progress = FALSE;
|
||||
cygheap_fdnew res_fd;
|
||||
|
||||
/* Allows NULL peer and len parameters. */
|
||||
struct sockaddr_in peer_dummy;
|
||||
@@ -593,19 +592,28 @@ fhandler_socket::accept (struct sockaddr *peer, int *len)
|
||||
}
|
||||
}
|
||||
|
||||
if (res_fd < 0)
|
||||
/* FIXME: what is correct errno? */;
|
||||
else if ((SOCKET) res == (SOCKET) INVALID_SOCKET)
|
||||
if ((SOCKET) res == (SOCKET) INVALID_SOCKET)
|
||||
set_winsock_errno ();
|
||||
else
|
||||
{
|
||||
fhandler_socket* res_fh = fdsock (res_fd, get_name (), res);
|
||||
if (get_addr_family () == AF_LOCAL)
|
||||
res_fh->set_sun_path (get_sun_path ());
|
||||
res_fh->set_addr_family (get_addr_family ());
|
||||
res_fh->set_socket_type (get_socket_type ());
|
||||
res_fh->set_connect_state (CONNECTED);
|
||||
res = res_fd;
|
||||
cygheap_fdnew res_fd;
|
||||
fhandler_socket* res_fh = NULL;
|
||||
if (res_fd >= 0)
|
||||
res_fh = fdsock (res_fd, get_name (), res);
|
||||
if (res_fh)
|
||||
{
|
||||
if (get_addr_family () == AF_LOCAL)
|
||||
res_fh->set_sun_path (get_sun_path ());
|
||||
res_fh->set_addr_family (get_addr_family ());
|
||||
res_fh->set_socket_type (get_socket_type ());
|
||||
res_fh->set_connect_state (CONNECTED);
|
||||
res = res_fd;
|
||||
}
|
||||
else
|
||||
{
|
||||
closesocket (res);
|
||||
res = -1;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
|
Reference in New Issue
Block a user