mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-15 07:15:03 -04:00
Pass flags to fcntl(F_SETFL) and fcntl(F_SETFD) 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:
parent
e73cbde15f
commit
7c2dea1615
4
evutil.c
4
evutil.c
@ -248,7 +248,7 @@ evutil_make_socket_nonblocking(evutil_socket_t 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;
|
||||||
@ -281,7 +281,7 @@ int
|
|||||||
evutil_make_socket_closeonexec(evutil_socket_t fd)
|
evutil_make_socket_closeonexec(evutil_socket_t fd)
|
||||||
{
|
{
|
||||||
#if !defined(WIN32) && defined(_EVENT_HAVE_SETFD)
|
#if !defined(WIN32) && defined(_EVENT_HAVE_SETFD)
|
||||||
long flags;
|
int flags;
|
||||||
if ((flags = fcntl(fd, F_GETFD, NULL)) < 0) {
|
if ((flags = fcntl(fd, F_GETFD, NULL)) < 0) {
|
||||||
event_warn("fcntl(%d, F_GETFD)", fd);
|
event_warn("fcntl(%d, F_GETFD)", fd);
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user