From: Azat Khuzhin Date: Sun, 9 Dec 2018 11:48:44 +0000 (+0300) Subject: Do not check O_NONBLOCK for invalid fds X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9d3a415a99bbc6a7e0f0b12ae3c6c5c7e4613cf1;p=libevent Do not check O_NONBLOCK for invalid fds Fixes: 6f988ee1 ("Merge branch 'check-O_NONBLOCK-in-debug'") --- diff --git a/event.c b/event.c index 4f4c9d77..3816650e 100644 --- a/event.c +++ b/event.c @@ -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