From: Greg Hudson Date: Fri, 25 Mar 2011 15:46:03 +0000 (+0000) Subject: Set better error messages when plugins fail to load. X-Git-Tag: krb5-1.10-alpha1~520 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=28ac64d3ee77fdab219974ddea3b046639f421b1;p=krb5.git 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 --- diff --git a/src/util/support/plugins.c b/src/util/support/plugins.c index c1520568a..ce65e1bca 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) {