]> granicus.if.org Git - libevent/commitdiff
Pass flags to fcntl(F_SETFL) and fcntl(F_SETFD) as int, not long
authorNick Mathewson <nickm@torproject.org>
Tue, 13 Jul 2010 15:06:08 +0000 (11:06 -0400)
committerNick Mathewson <nickm@torproject.org>
Tue, 13 Jul 2010 15:09:47 +0000 (11:09 -0400)
Everybody but Linux documents this as taking an int, and Linux is
very tolerant of getting an int instead.  If it weren't, everybody
doing fcntl(fd,F_SETFL,O_NONBLOCK) would break, since the glibc
headers define O_NONBLOCK as an int literal.

evutil.c

index d0621bfacfbb4e54c7ab971c7b768cc1b9bbc8e1..409a5d8400251b5179aa098d0b367cacf5fe33b7 100644 (file)
--- a/evutil.c
+++ b/evutil.c
@@ -248,7 +248,7 @@ evutil_make_socket_nonblocking(evutil_socket_t fd)
        }
 #else
        {
-               long flags;
+               int flags;
                if ((flags = fcntl(fd, F_GETFL, NULL)) < 0) {
                        event_warn("fcntl(%d, F_GETFL)", fd);
                        return -1;
@@ -281,7 +281,7 @@ int
 evutil_make_socket_closeonexec(evutil_socket_t fd)
 {
 #if !defined(WIN32) && defined(_EVENT_HAVE_SETFD)
-       long flags;
+       int flags;
        if ((flags = fcntl(fd, F_GETFD, NULL)) < 0) {
                event_warn("fcntl(%d, F_GETFD)", fd);
                return -1;