* fhandler_socket.cc (fhandler_socket::accept4): Set nonblocking

flag exactly according to flags, as on Linux.
	* net.cc (cygwin_accept): Maintain BSD semantics here.
This commit is contained in:
Corinna Vinschen 2010-01-15 21:34:27 +00:00
parent be0ca195b9
commit 9d5bf1b13c
3 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2010-01-15 Pierre A. Humblet <phumblet@phumblet.no-ip.org>
* fhandler_socket.cc (fhandler_socket::accept4): Set nonblocking
flag exactly according to flags, as on Linux.
* net.cc (cygwin_accept): Maintain BSD semantics here.
2010-01-15 Corinna Vinschen <corinna@vinschen.de>
* cygwin.din (accept4): Export.

View File

@ -1236,8 +1236,7 @@ fhandler_socket::accept4 (struct sockaddr *peer, int *len, int flags)
}
}
}
sock->set_nonblocking (flags & SOCK_NONBLOCK
? true : is_nonblocking ());
sock->set_nonblocking (flags & SOCK_NONBLOCK);
if (flags & SOCK_CLOEXEC)
sock->set_close_on_exec (true);
/* No locking necessary at this point. */

View File

@ -1256,7 +1256,7 @@ cygwin_accept (int fd, struct sockaddr *peer, socklen_t *len)
if (efault.faulted (EFAULT) || !fh)
res = -1;
else
res = fh->accept4 (peer, len, 0);
res = fh->accept4 (peer, len, fh->is_nonblocking () ? SOCK_NONBLOCK : 0);
syscall_printf ("%d = accept (%d, %p, %p)", res, fd, peer, len);
return res;