summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 48cde21)
raw | patch | inline | side by side (parent: 48cde21)
author | Florian Forster <octo@huhu.verplant.org> | |
Wed, 9 Feb 2011 06:28:03 +0000 (07:28 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Wed, 9 Feb 2011 06:28:03 +0000 (07:28 +0100) |
Since the Debian package doesn't depend on the libraries used by the
collectd plugins, some plugins may fail to load. ltdl reports this with
the very confusing error message "file not found". Since the plugin is
in fact available, many users don't realize a dependency is missing and
assume collectd is looking in the wrong directory -- and they are hardly
to blame for this.
This commit introduces a lengthy error message which hopefully points
users into the right direction.
collectd plugins, some plugins may fail to load. ltdl reports this with
the very confusing error message "file not found". Since the plugin is
in fact available, many users don't realize a dependency is missing and
assume collectd is looking in the wrong directory -- and they are hardly
to blame for this.
This commit introduces a lengthy error message which hopefully points
users into the right direction.
src/plugin.c | patch | blob | history |
diff --git a/src/plugin.c b/src/plugin.c
index 307bbf4f733bffe9a22cca2de5b71f6981f343b1..492be214a727d36ac6cc9f059199382650628e6b 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
lt_dlhandle dlh;
void (*reg_handle) (void);
- DEBUG ("file = %s", file);
-
lt_dlinit ();
lt_dlerror (); /* clear errors */
}
#else /* if LIBTOOL_VERSION == 1 */
if (flags & PLUGIN_FLAGS_GLOBAL)
- ERROR ("plugin_load_file: The global flag is not supported, "
+ WARNING ("plugin_load_file: The global flag is not supported, "
"libtool 2 is required for this.");
dlh = lt_dlopen (file);
#endif
if (dlh == NULL)
{
- const char *error = lt_dlerror ();
+ char errbuf[1024] = "";
+
+ ssnprintf (errbuf, sizeof (errbuf),
+ "lt_dlopen (\"%s\") failed: %s. "
+ "The most common cause for this problem are "
+ "missing dependencies. Use ldd(1) to check "
+ "the dependencies of the plugin "
+ "/ shared object.",
+ file, lt_dlerror ());
+
+ ERROR ("%s", errbuf);
+ /* Make sure this is printed to STDERR in any case, but also
+ * make sure it's printed only once. */
+ if (list_log != NULL)
+ fprintf (stderr, "ERROR: %s\n", errbuf);
- ERROR ("lt_dlopen (%s) failed: %s", file, error);
- fprintf (stderr, "lt_dlopen (%s) failed: %s\n", file, error);
return (1);
}
if ((reg_handle = (void (*) (void)) lt_dlsym (dlh, "module_register")) == NULL)
{
- WARNING ("Couldn't find symbol `module_register' in `%s': %s\n",
+ WARNING ("Couldn't find symbol \"module_register\" in \"%s\": %s\n",
file, lt_dlerror ());
lt_dlclose (dlh);
return (-1);