proper checking for dlerror on failed dso load

This commit is contained in:
Anthony Minessale 2010-04-21 09:53:26 -05:00
parent 08dcb79360
commit 964d59c56e
1 changed files with 10 additions and 1 deletions

View File

@ -127,7 +127,16 @@ void *switch_dso_data_sym(switch_dso_lib_t lib, const char *sym, char **err)
{
void *addr = dlsym(lib, sym);
if (!addr) {
*err = strdup(dlerror());
char *err_str = NULL;
dlerror();
if (!(addr = dlsym(lib, sym))) {
err_str = dlerror();
}
if (err_str) {
*err = strdup(err_str);
}
}
return addr;
}