From 1efc6d03d13ee444a7b10abb4a4a35309d811cd8 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 11 May 2026 11:40:46 +1000 Subject: [PATCH] util: only close fds larger than -1 in cleanup_close This allows us to pass xerrno() results (i.e. negative errnos) and still do the right thing. Assisted-by: Claude:claude-opus-4-6 Part-of: --- src/util-io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util-io.h b/src/util-io.h index 26cf02a..21d5d81 100644 --- a/src/util-io.h +++ b/src/util-io.h @@ -127,7 +127,7 @@ xerrno(int value) static inline int xclose(int fd) { - if (fd != -1) { + if (fd > -1) { /* Not SYSCALL(), see libei MR!261#note_2131802 */ close(fd); }