Only call dlerror() after dlsym() failed.

git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@520 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
Dag-Erling Smørgrav 2012-01-10 23:57:31 +00:00
parent 31e9142afc
commit 34c9fb6fd3
1 changed files with 9 additions and 5 deletions

View File

@ -143,11 +143,15 @@ openpam_dynamic(const char *path)
module->dlh = dlh;
dlmodule = dlsym(dlh, "_pam_module");
for (i = 0; i < PAM_NUM_PRIMITIVES; ++i) {
module->func[i] = dlmodule ? dlmodule->func[i] :
(pam_func_t)dlsym(dlh, pam_sm_func_name[i]);
if (module->func[i] == NULL)
openpam_log(PAM_LOG_DEBUG, "%s: %s(): %s",
path, pam_sm_func_name[i], dlerror());
if (dlmodule) {
module->func[i] = dlmodule->func[i];
} else {
module->func[i] =
(pam_func_t)dlsym(dlh, pam_sm_func_name[i]);
if (module->func[i] == NULL)
openpam_log(PAM_LOG_DEBUG, "%s: %s(): %s",
path, pam_sm_func_name[i], dlerror());
}
}
return (module);
buf_err: