]> granicus.if.org Git - libevent/commitdiff
Adjusted fcntl() retval comparison on evutil_make_socket_nonblocking().
authorJardel Weyrich <jweyrich@gmail.com>
Tue, 29 Dec 2009 18:19:24 +0000 (16:19 -0200)
committerNick Mathewson <nickm@torproject.org>
Tue, 29 Dec 2009 20:11:52 +0000 (15:11 -0500)
Apparently, a successful return value on F_SETFL is "anything but
-1".

evutil.c

index 800e40b2db0c1d3aea0a11a64bf5ce7750757819..3beb4bf76668baee190b05be6ef6da610e9ffb85 100644 (file)
--- a/evutil.c
+++ b/evutil.c
@@ -187,11 +187,11 @@ evutil_make_socket_nonblocking(evutil_socket_t fd)
        {
                long flags;
                if ((flags = fcntl(fd, F_GETFL, NULL)) < 0) {
-                       event_warn("fcntl(F_GETFL)");
+                       event_warn("fcntl(%d, F_GETFL)", fd);
                        return -1;
                }
-               if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
-                       event_warn("fcntl(O_NONBLOCK)");
+               if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1) {
+                       event_warn("fcntl(%d, F_SETFL)", fd);
                        return -1;
                }
        }