plugin.c: Tell the user if a plugin could not be found.
[collectd.git] / src / plugin.c
index 007d094..acf7620 100644 (file)
@@ -133,6 +133,7 @@ static int plugin_load_file (char *file)
                const char *error = lt_dlerror ();
 
                ERROR ("lt_dlopen failed: %s", error);
+               fprintf (stderr, "lt_dlopen failed: %s\n", error);
                return (1);
        }
 
@@ -296,7 +297,7 @@ int plugin_load (const char *type)
 {
        DIR  *dh;
        const char *dir;
-       char  filename[BUFSIZE];
+       char  filename[BUFSIZE] = "";
        char  typename[BUFSIZE];
        int   typename_len;
        int   ret;
@@ -355,10 +356,17 @@ int plugin_load (const char *type)
                        ret = 0;
                        break;
                }
+               else
+               {
+                       fprintf (stderr, "Unable to load plugin %s.\n", type);
+               }
        }
 
        closedir (dh);
 
+       if (filename[0] == '\0')
+               fprintf (stderr, "Could not find plugin %s.\n", type);
+
        return (ret);
 }