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: <https://gitlab.freedesktop.org/libinput/libei/-/merge_requests/388>
This commit is contained in:
Peter Hutterer 2026-05-11 11:40:46 +10:00 committed by Marge Bot
parent c6c8f47b43
commit 1efc6d03d1

View file

@ -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);
}