Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2000-10-25 12:47:23 +0400
committerCorinna Vinschen <corinna@vinschen.de>2000-10-25 12:47:23 +0400
commit2f7356f39bf87cd3b509cb1dc3cfafab086aaf58 (patch)
tree8f9244d774a96331840f171f031d5e916d805045 /winsup/cygwin/net.cc
parentd220f0b21c2b466dde5442feeb915cf2561939a2 (diff)
* fhandler.cc (fhandler_base::fcntl): Treat O_NONBLOCK and OLD_O_NDELAY
as exactly the same. If one is set, both are set. * net.cc (fhandler_socket::fcntl): Ditto.
Diffstat (limited to 'winsup/cygwin/net.cc')
-rw-r--r--winsup/cygwin/net.cc23
1 files changed, 15 insertions, 8 deletions
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 10153f417..d5e358c10 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -1988,15 +1988,22 @@ fhandler_socket::fcntl (int cmd, void *arg)
switch (cmd)
{
case F_SETFL:
- request = ((int) arg & O_NONBLOCK) ? 1 : 0;
- current = (get_flags () & O_NONBLOCK) ? 1 : 0;
- if (request != current && (res = ioctl (FIONBIO, &request)))
+ {
+ /* Care for the old O_NDELAY flag. If one of the flags is set,
+ both flags are set. */
+ int new_flags = (int) arg;
+ if (new_flags & (O_NONBLOCK | OLD_O_NDELAY))
+ new_flags |= O_NONBLOCK | OLD_O_NDELAY;
+ request = (new_flags & O_NONBLOCK) ? 1 : 0;
+ current = (get_flags () & O_NONBLOCK) ? 1 : 0;
+ if (request != current && (res = ioctl (FIONBIO, &request)))
+ break;
+ if (request)
+ set_flags (get_flags () | O_NONBLOCK | OLD_O_NDELAY);
+ else
+ set_flags (get_flags () & ~(O_NONBLOCK | OLD_O_NDELAY));
break;
- if (request)
- set_flags (get_flags () | O_NONBLOCK);
- else
- set_flags (get_flags () & ~O_NONBLOCK);
- break;
+ }
default:
res = fhandler_base::fcntl (cmd, arg);
break;