Skip to content

Commit c00710e

Browse files
committed
Fix loading absolute path libs with LD_LIBRARY_PATH
Commit 5aa5b08 changed the way libraries are dynamically loaded when `LD_LIBRARY_PATH` is set to only take the filename into account and not the complete path. This seems to be overlooked code meant for testing as the commit is about video testing and not library loading. Revert the file to its previous state to fix loading libraries that are specified with absolute paths. Fixes GitHub issue KhronosGroup#479.
1 parent f674555 commit c00710e

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

framework/delibs/deutil/deDynamicLibrary.c

+1-14
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
/* Posix implementation. */
3030

3131
#include <dlfcn.h>
32-
#include <libgen.h>
33-
#include <stdlib.h>
3432

3533
struct deDynamicLibrary_s
3634
{
@@ -43,18 +41,7 @@ deDynamicLibrary *deDynamicLibrary_open(const char *fileName)
4341
if (!library)
4442
return NULL;
4543

46-
if (getenv("LD_LIBRARY_PATH"))
47-
{
48-
// basename() requires a non-const string because it may modify the its contents, so we cannot pass fileName to
49-
// it directly. The string may be coming from statically allocated memory. E.g. this segfaulted in FreeBSD.
50-
char *aux = deStrdup(fileName);
51-
if (!aux)
52-
return NULL;
53-
library->libHandle = dlopen(basename(aux), RTLD_LAZY);
54-
deFree(aux);
55-
}
56-
else
57-
library->libHandle = dlopen(fileName, RTLD_LAZY);
44+
library->libHandle = dlopen(fileName, RTLD_LAZY);
5845

5946
if (!library->libHandle)
6047
{

0 commit comments

Comments
 (0)