svn rev #24744: trunk/src/util/support/

ghudson@MIT.EDU ghudson at MIT.EDU
Fri Mar 25 11:46:04 EDT 2011


http://src.mit.edu/fisheye/changelog/krb5/?cs=24744
Commit By: ghudson
Log Message:
Set better error messages when plugins fail to load.
(From r24741 in users/lhowards/moonshot-mechglue-fixes.)



Changed Files:
U   trunk/src/util/support/plugins.c
Modified: trunk/src/util/support/plugins.c
===================================================================
--- trunk/src/util/support/plugins.c	2011-03-24 01:24:42 UTC (rev 24743)
+++ trunk/src/util/support/plugins.c	2011-03-25 15:46:03 UTC (rev 24744)
@@ -172,8 +172,10 @@
 
     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 @@
 #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 @@
         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 @@
 
     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) {




More information about the cvs-krb5 mailing list