Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions framework/delibs/deutil/deDynamicLibrary.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
/* Posix implementation. */

#include <dlfcn.h>
#include <libgen.h>
#include <stdlib.h>

struct deDynamicLibrary_s
{
Expand All @@ -43,18 +41,7 @@ deDynamicLibrary *deDynamicLibrary_open(const char *fileName)
if (!library)
return NULL;

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

if (!library->libHandle)
{
Expand Down