summaryrefslogtreecommitdiffstats
path: root/src/util/support/plugins.c
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2011-03-25 15:46:03 +0000
committerGreg Hudson <ghudson@mit.edu>2011-03-25 15:46:03 +0000
commit28ac64d3ee77fdab219974ddea3b046639f421b1 (patch)
treef92de79f42e6fdd0640b1a0b3e4812e9e4edf14b /src/util/support/plugins.c
parent324b0c76237a9c1e72a63de3aaa71c1feb5e1b79 (diff)
downloadkrb5-28ac64d3ee77fdab219974ddea3b046639f421b1.tar.gz
krb5-28ac64d3ee77fdab219974ddea3b046639f421b1.tar.xz
krb5-28ac64d3ee77fdab219974ddea3b046639f421b1.zip
Set better error messages when plugins fail to load.
(From r24741 in users/lhowards/moonshot-mechglue-fixes.) git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24744 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util/support/plugins.c')
-rw-r--r--src/util/support/plugins.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/util/support/plugins.c b/src/util/support/plugins.c
index c1520568a4..ce65e1bca1 100644
--- a/src/util/support/plugins.c
+++ b/src/util/support/plugins.c
@@ -172,8 +172,10 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct
if (!err) {
if (stat (filepath, &statbuf) < 0) {
- Tprintf ("stat(%s): %s\n", filepath, strerror (errno));
err = errno;
+ Tprintf ("stat(%s): %s\n", filepath, strerror (err));
+ krb5int_set_error(ep, err, "unable to find plugin [%s]: %s",
+ filepath, strerror(err));
}
}
@@ -261,14 +263,15 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct
#define PLUGIN_DLOPEN_FLAGS (RTLD_NOW | RTLD_LOCAL)
#endif
if (!err) {
- handle = dlopen(filepath, PLUGIN_DLOPEN_FLAGS);
+ handle = dlopen(filepath, PLUGIN_DLOPEN_FLAGS | RTLD_NODELETE);
if (handle == NULL) {
const char *e = dlerror();
if (e == NULL)
e = "unknown failure";
Tprintf ("dlopen(%s): %s\n", filepath, e);
err = ENOENT; /* XXX */
- krb5int_set_error (ep, err, "%s", e);
+ krb5int_set_error(ep, err, "unable to load plugin [%s]: %s",
+ filepath, e);
}
}
@@ -290,7 +293,7 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct
if (handle == NULL) {
Tprintf ("Unable to load dll: %s\n", filepath);
err = ENOENT; /* XXX */
- krb5int_set_error (ep, err, "%s", "unable to load dll");
+ krb5int_set_error (ep, err, "unable to load DLL [%s]", filepath);
}
if (!err) {
@@ -306,6 +309,7 @@ krb5int_open_plugin (const char *filepath, struct plugin_file_handle **h, struct
if (!err && !got_plugin) {
err = ENOENT; /* no plugin or no way to load plugins */
+ krb5int_set_error (ep, err, "plugin unavailable: %s", strerror(err));
}
if (!err) {