Pass flags to fcntl(F_SETFL) as int, not long

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.
This commit is contained in:
Nick Mathewson 2010-07-13 11:06:08 -04:00
parent eb8122f26c
commit b3d03822e4

View File

@ -169,7 +169,7 @@ evutil_make_socket_nonblocking(int fd)
} }
#else #else
{ {
long flags; int flags;
if ((flags = fcntl(fd, F_GETFL, NULL)) < 0) { if ((flags = fcntl(fd, F_GETFL, NULL)) < 0) {
event_warn("fcntl(%d, F_GETFL)", fd); event_warn("fcntl(%d, F_GETFL)", fd);
return -1; return -1;