Do not check O_NONBLOCK for invalid fds

Fixes: 6f988ee1 ("Merge branch 'check-O_NONBLOCK-in-debug'")
(cherry picked from commit 9d3a415a99bbc6a7e0f0b12ae3c6c5c7e4613cf1)
This commit is contained in:
Azat Khuzhin 2018-12-09 14:48:44 +03:00
parent f9c5d17b0a
commit a8155c62d8
No known key found for this signature in database
GPG Key ID: B86086848EF8686D

13
event.c
View File

@ -373,17 +373,18 @@ static void event_debug_assert_not_added_(const struct event *ev)
}
static void event_debug_assert_socket_nonblocking_(evutil_socket_t fd)
{
int flags;
if (!event_debug_mode_on_)
return;
if (fd < 0)
return;
#ifndef _WIN32
if ((flags = fcntl(fd, F_GETFL, NULL)) >= 0) {
EVUTIL_ASSERT(flags & O_NONBLOCK);
{
int flags;
if ((flags = fcntl(fd, F_GETFL, NULL)) >= 0) {
EVUTIL_ASSERT(flags & O_NONBLOCK);
}
}
#else
(void)flags;
#endif
}
#else