Commit 9bae6ff50c for qemu.org
commit 9bae6ff50c483b31a495a361ad50a37680666245
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date: Wed Oct 21 11:34:49 2026 +0400
glib-compat: fix g_autofd fallback warnings
The g_autofd fallback is warning because it uses symbols from >=2.66
Fixes: 1599015a7a1a ("glib-compat: add fallback for g_clear_fd/g_autofd")
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
diff --git a/include/glib-compat.h b/include/glib-compat.h
index 32ee2afdcd..dd6f062f5a 100644
--- a/include/glib-compat.h
+++ b/include/glib-compat.h
@@ -148,15 +148,15 @@ static inline gboolean g_clear_fd_qemu(int *fd_ptr, GError **error)
}
#define g_clear_fd(fd, err) g_clear_fd_qemu(fd, err)
-#if !GLIB_CHECK_VERSION(2, 76, 0)
-static inline void _g_clear_fd_ignore_error(int *fd_ptr)
+static inline void _g_clear_fd_qemu_ignore_error(int *fd_ptr)
{
int errsv = errno;
g_clear_fd(fd_ptr, NULL);
errno = errsv;
}
-#define g_autofd __attribute__((cleanup(_g_clear_fd_ignore_error)))
-#endif
+
+#undef g_autofd
+#define g_autofd __attribute__((cleanup(_g_clear_fd_qemu_ignore_error)))
#pragma GCC diagnostic pop