at 18.09-beta 1.3 kB view raw
1From 4046e0ac8ed93354c01de5f3b5cae790cce70404 Mon Sep 17 00:00:00 2001 2From: Will Dietz <w@wdtz.org> 3Date: Thu, 29 Mar 2018 07:21:02 -0500 4Subject: [PATCH] Explicitly search LIBGL_PATH as fallback, if defined. 5 6--- 7 src/dispatch_common.c | 12 ++++++++++++ 8 1 file changed, 12 insertions(+) 9 10diff --git a/src/dispatch_common.c b/src/dispatch_common.c 11index bc2fb94..776237b 100644 12--- a/src/dispatch_common.c 13+++ b/src/dispatch_common.c 14@@ -306,6 +306,18 @@ get_dlopen_handle(void **handle, const char *lib_name, bool exit_on_fail) 15 pthread_mutex_lock(&api.mutex); 16 if (!*handle) { 17 *handle = dlopen(lib_name, RTLD_LAZY | RTLD_LOCAL); 18+#ifdef LIBGL_PATH 19+ if (!*handle) { 20+ char pathbuf[sizeof(LIBGL_PATH) + 1 + 1024 + 1]; 21+ int l = snprintf(pathbuf, sizeof(pathbuf), "%s/%s", LIBGL_PATH, lib_name); 22+ if (l < 0 || l >= sizeof(pathbuf)) { 23+ // This really shouldn't happen 24+ fprintf(stderr, "Error prefixing library pathname\n"); 25+ exit(1); 26+ } 27+ *handle = dlopen(pathbuf, RTLD_LAZY | RTLD_LOCAL); 28+ } 29+#endif 30 if (!*handle) { 31 if (exit_on_fail) { 32 fprintf(stderr, "Couldn't open %s: %s\n", lib_name, dlerror()); 33-- 342.16.3 35