From f2702557705b604d9dc92b91cd8be51b264049e9 Mon Sep 17 00:00:00 2001 From: apocelipes Date: Tue, 6 May 2025 16:18:53 +0800 Subject: [PATCH] DisplayServer (Linux): fix xcb_connect error handling (#1735) --- src/detection/displayserver/linux/xcb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/detection/displayserver/linux/xcb.c b/src/detection/displayserver/linux/xcb.c index d71434820..beb6aac0a 100644 --- a/src/detection/displayserver/linux/xcb.c +++ b/src/detection/displayserver/linux/xcb.c @@ -335,6 +335,7 @@ const char* ffdsConnectXcbRandr(FFDisplayServerResult* result) { FF_LIBRARY_LOAD(xcbRandr, "dlopen libxcb-randr failed", "libxcb-randr" FF_LIBRARY_EXTENSION, 1) FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xcbRandr, xcb_connect) + FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xcbRandr, xcb_connection_has_error) FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xcbRandr, xcb_get_setup) FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xcbRandr, xcb_setup_roots_iterator) FF_LIBRARY_LOAD_SYMBOL_MESSAGE(xcbRandr, xcb_screen_next) @@ -368,8 +369,11 @@ const char* ffdsConnectXcbRandr(FFDisplayServerResult* result) data.connection = ffxcb_connect(NULL, NULL); - if(data.connection == NULL) + if(ffxcb_connection_has_error(data.connection) > 0) + { + ffxcb_disconnect(data.connection); return "xcb_connect() failed"; + } data.result = result;