Actually, there is no good general solution, because the rtld does not
set errno. Here's what I came up with:
Index: openpam_dynamic.c
===================================================================
--- openpam_dynamic.c (revision 509)
+++ openpam_dynamic.c (working copy)
@@ -63,10 +63,15 @@
static void *
try_dlopen(const char *modfn)
{
+ void *dlh;
if (openpam_check_path_owner_perms(modfn) != 0)
return (NULL);
- return (dlopen(modfn, RTLD_NOW));
+ if ((dlh = dlopen(modfn, RTLD_NOW)) == NULL) {
+ openpam_log(PAM_LOG_DEBUG, "%s: %s", modfn, dlerror());
+ errno = 0;
+ }
+ return (dlh);
}
/*
@@ -124,7 +129,8 @@
dlclose(dlh);
FREE(module);
err:
- openpam_log(PAM_LOG_ERROR, "%m");
+ if (errno != 0)
+ openpam_log(PAM_LOG_ERROR, "%s: %m", path);
return (NULL);
}
I'll wait for your feedback before I commit it.
DES
--
Dag-Erling Smørgrav - [email protected]
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"