From 6971fe4ca52ebdaa85ba676a044412b01d2ef1bf Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 1 Nov 2012 22:59:19 -0700 Subject: [PATCH] Allow dlopen("egl/blah.so"). NVIDIA binary blobs construct strings to pass to dlopen(3) that contain '/' but require that we fall back to LD_LIBRARY_PATH. Change-Id: Iad831899986baace6962f4b335eeb288250a1e22 --- linker/linker.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/linker/linker.cpp b/linker/linker.cpp index 99cd92bd3..40f29a237 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -634,7 +634,11 @@ static int open_library(const char* name) { // If the name contains a slash, we should attempt to open it directly and not search the paths. if (strchr(name, '/') != NULL) { - return TEMP_FAILURE_RETRY(open(name, O_RDONLY | O_CLOEXEC)); + int fd = TEMP_FAILURE_RETRY(open(name, O_RDONLY | O_CLOEXEC)); + if (fd != -1) { + return fd; + } + // ...but nvidia binary blobs (at least) rely on this behavior, so fall through for now. } // Otherwise we try LD_LIBRARY_PATH first, and fall back to the built-in well known paths.