at 24.11-pre 919 B view raw
1diff --git a/src/dispatch_common.c b/src/dispatch_common.c 2index b3e4f5f..303e8f5 100644 3--- a/src/dispatch_common.c 4+++ b/src/dispatch_common.c 5@@ -310,6 +310,19 @@ get_dlopen_handle(void **handle, const char *lib_name, bool exit_on_fail, bool l 6 flags |= RTLD_NOLOAD; 7 8 *handle = dlopen(lib_name, flags); 9+#ifdef LIBGL_PATH 10+ if (!*handle) { 11+ char pathbuf[sizeof(LIBGL_PATH) + 1 + 1024 + 1]; 12+ int l = snprintf(pathbuf, sizeof(pathbuf), "%s/%s", LIBGL_PATH, lib_name); 13+ if (l < 0 || l >= sizeof(pathbuf)) { 14+ // This really shouldn't happen 15+ fprintf(stderr, "Error prefixing library pathname\n"); 16+ exit(1); 17+ } 18+ *handle = dlopen(pathbuf, flags); 19+ } 20+#endif 21+ 22 if (!*handle) { 23 if (exit_on_fail) { 24 fprintf(stderr, "Couldn't open %s: %s\n", lib_name, dlerror());