From 70a44b61bb574d4e550ef7a4f933b95efc1a5316 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 12 Mar 2010 18:35:15 -0500 Subject: [PATCH] Avoid a spurious close(-1) on Linux On Linux, we use only one fd to do main-thread signaling (since we have eventfd()), so we don't need to close th_notify_fd[1] as we would if we were using a socketpair. --- event.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/event.c b/event.c index 4e3a84f7..469da7e6 100644 --- a/event.c +++ b/event.c @@ -648,7 +648,8 @@ event_base_free(struct event_base *base) if (base->th_notify_fd[0] != -1) { event_del(&base->th_notify); EVUTIL_CLOSESOCKET(base->th_notify_fd[0]); - EVUTIL_CLOSESOCKET(base->th_notify_fd[1]); + if (base->th_notify_fd[1] != -1) + EVUTIL_CLOSESOCKET(base->th_notify_fd[1]); base->th_notify_fd[0] = -1; base->th_notify_fd[1] = -1; event_debug_unassign(&base->th_notify); -- 2.40.0