From 5bd97c2f637104a5dcb774a8893fbe1313eaa871 Mon Sep 17 00:00:00 2001 From: LC Date: Sat, 11 Jul 2026 10:49:06 -0400 Subject: [PATCH] Common/Async: Handle fd closing a little better We should be checking against -1, rather than just anything non-zero. --- Source/Common/Async.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Common/Async.h b/Source/Common/Async.h index 58274b6fb..0c0b884fe 100644 --- a/Source/Common/Async.h +++ b/Source/Common/Async.h @@ -71,8 +71,10 @@ private: public: ~poll_reactor() { - if (AsyncStopRequest[0]) { + if (AsyncStopRequest[0] != -1) { ::close(AsyncStopRequest[0]); + } + if (AsyncStopRequest[1] != -1) { ::close(AsyncStopRequest[1]); } } @@ -92,6 +94,7 @@ public: } // Wake up run() thread by closing this pipe endpoint ::close(AsyncStopRequest[1]); + AsyncStopRequest[1] = -1; } void cleanup() {