From 9d5bf1b13cd23d6ade893195e81a58f1b4dcadb7 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 15 Jan 2010 21:34:27 +0000 Subject: [PATCH] * fhandler_socket.cc (fhandler_socket::accept4): Set nonblocking flag exactly according to flags, as on Linux. * net.cc (cygwin_accept): Maintain BSD semantics here. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/fhandler_socket.cc | 3 +-- winsup/cygwin/net.cc | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e68587585..86bdcab61 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2010-01-15 Pierre A. Humblet + + * 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 * cygwin.din (accept4): Export. diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index b5201939d..1526c084e 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -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. */ diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 93d39d9e5..ac83d4e53 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -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;