summaryrefslogtreecommitdiff
path: root/src/unix/system.c
diff options
context:
space:
mode:
authorAndrey Nazarov <skuller@skuller.net>2013-04-10 21:22:23 +0400
committerAndrey Nazarov <skuller@skuller.net>2013-04-12 20:30:48 +0400
commit8fef47aee73fbc0361a4f887541c8b1b36f7fd1a (patch)
tree22f0cc4e4217129550023f36c1ee7c2fccfa19e8 /src/unix/system.c
parent0e693b55ff8499ed9c96da0c3bba7a39de5b416b (diff)
Allow fixed linking to LIBGL/LIBAL.
Also check that all core functions are present when doing dynamic linking to improve robustness.
Diffstat (limited to 'src/unix/system.c')
-rw-r--r--src/unix/system.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/unix/system.c b/src/unix/system.c
index 68e685f..24642a2 100644
--- a/src/unix/system.c
+++ b/src/unix/system.c
@@ -275,6 +275,7 @@ void *Sys_LoadLibrary(const char *path, const char *sym, void **handle)
*handle = NULL;
+ dlerror();
module = dlopen(path, RTLD_LAZY);
if (!module) {
Com_SetLastError(dlerror());
@@ -299,7 +300,14 @@ void *Sys_LoadLibrary(const char *path, const char *sym, void **handle)
void *Sys_GetProcAddress(void *handle, const char *sym)
{
- return dlsym(handle, sym);
+ void *entry;
+
+ dlerror();
+ entry = dlsym(handle, sym);
+ if (!entry)
+ Com_SetLastError(dlerror());
+
+ return entry;
}
/*