about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2013-07-24 09:02:38 +0000
committerEric Wong <normalperson@yhbt.net>2013-07-24 09:02:38 +0000
commitc42a0324e4f2fa036f0fc6da785faad4b4d6714e (patch)
tree8f93c42e57fd687556b8d84293f274e2c6b2a4eb
parentb99e6cbd055fbf8664ee510c2e60854d10c69d51 (diff)
downloadlibnodelay-c42a0324e4f2fa036f0fc6da785faad4b4d6714e.tar.gz
use mask to get SOCK_STREAM arg from socket syscall
Linux may OR SOCK_CLOEXEC and SOCK_NONBLOCK, so we must mask
those flags out to match SOCK_STREAM.
-rw-r--r--nodelay.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/nodelay.c b/nodelay.c
index 265b0d6..afbb30e 100644
--- a/nodelay.c
+++ b/nodelay.c
@@ -55,7 +55,7 @@ int socket(int domain, int type, int protocol)
 
         if (fd >= 0 &&
             protocol == IPPROTO_TCP &&
-            type == SOCK_STREAM &&
+            (type & SOCK_STREAM) == SOCK_STREAM &&
             domain == PF_INET) {
                 int orig_errno = errno;
                 int optval = nodelay_value;