From 333479e6be9ea202cb8a6569a0da7489dafaaefb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Mon, 24 Mar 2025 12:09:39 +0100
Subject: [PATCH] `MonitorFdHup::~MonitorFdHup`: use proper close method
 instead of libc close()

Otherwise closing it again will cause an EBADF in the AutoCloseFd class.

(cherry picked from commit 87a34a45ff7e176a5ef291b1c923f4d637095a97)
---
 src/libutil/unix/monitor-fd.hh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libutil/unix/monitor-fd.hh b/src/libutil/unix/monitor-fd.hh
index d59832452..c1f8705eb 100644
--- a/src/libutil/unix/monitor-fd.hh
+++ b/src/libutil/unix/monitor-fd.hh
@@ -122,7 +122,7 @@ public:
 
     ~MonitorFdHup()
     {
-        close(notifyPipe.writeSide.get());
+        notifyPipe.writeSide.close();
         thread.join();
     }
 };