about summary refs log tree commit homepage
path: root/ext/kgio/nonblock.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/kgio/nonblock.h')
-rw-r--r--ext/kgio/nonblock.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/kgio/nonblock.h b/ext/kgio/nonblock.h
index 43de8cd..2d9a13a 100644
--- a/ext/kgio/nonblock.h
+++ b/ext/kgio/nonblock.h
@@ -5,11 +5,15 @@ static void set_nonblocking(int fd)
 {
         int flags = fcntl(fd, F_GETFL);
 
+        /*
+         * do not check < 0 here, one day we may have enough FD flags
+         * to require negative bit
+         */
         if (flags == -1)
                 rb_sys_fail("fcntl(F_GETFL)");
         if ((flags & O_NONBLOCK) == O_NONBLOCK)
                 return;
         flags = fcntl(fd, F_SETFL, flags | O_NONBLOCK);
-        if (flags == -1)
+        if (flags < 0)
                 rb_sys_fail("fcntl(F_SETFL)");
 }