From cf0963e6682e80cfcc639a47f31c1d344b0e280e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Wed, 11 Jan 2012 00:45:09 +0000 Subject: [PATCH] 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 --- lib/openpam_dynamic.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/openpam_dynamic.c b/lib/openpam_dynamic.c index 06ca141..1446abe 100644 --- a/lib/openpam_dynamic.c +++ b/lib/openpam_dynamic.c @@ -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); }