Improve error messages by logging the full path of the module we tried

to load rather than just the module name.


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@525 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
Dag-Erling Smørgrav 2012-01-11 00:45:09 +00:00
parent c3d9f63b55
commit cf0963e668
1 changed files with 8 additions and 5 deletions

View File

@ -99,7 +99,7 @@ try_dlopen(const char *modfn)
return (dlh);
}
#endif
/*
* OpenPAM internal
*
@ -131,9 +131,6 @@ openpam_dynamic(const char *path)
*strrchr(vpath, '.') = '\0';
dlh = try_dlopen(vpath);
}
serrno = errno;
FREE(vpath);
errno = serrno;
if (dlh == NULL)
goto err;
if ((module = calloc(1, sizeof *module)) == NULL)
@ -164,14 +161,20 @@ openpam_dynamic(const char *path)
#endif
}
}
FREE(vpath);
return (module);
buf_err:
serrno = errno;
if (dlh != NULL)
dlclose(dlh);
FREE(module);
errno = serrno;
err:
serrno = errno;
if (errno != 0)
openpam_log(PAM_LOG_ERROR, "%s: %m", path);
openpam_log(PAM_LOG_ERROR, "%s: %m", vpath);
FREE(vpath);
errno = serrno;
return (NULL);
}