summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 31e21fb)
raw | patch | inline | side by side (parent: 31e21fb)
author | Florian Forster <octo@collectd.org> | |
Mon, 21 Jan 2013 10:36:48 +0000 (11:36 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Mon, 21 Jan 2013 10:36:50 +0000 (11:36 +0100) |
Fixes Github issue #237.
src/plugin.c | patch | blob | history |
diff --git a/src/plugin.c b/src/plugin.c
index 547b5eb56da30f590cfbc3dc74c760d162bf5518..478ec52c252533ef0b42ec292ea01ecfc8812f68 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
struct dirent *de;
int status;
- DEBUG ("type = %s", type);
-
dir = plugin_get_dir ();
ret = 1;
status = ssnprintf (typename, sizeof (typename), "%s.so", type);
if ((status < 0) || ((size_t) status >= sizeof (typename)))
{
- WARNING ("snprintf: truncated: `%s.so'", type);
+ WARNING ("plugin_load: Filename too long: \"%s.so\"", type);
return (-1);
}
typename_len = strlen (typename);
if ((dh = opendir (dir)) == NULL)
{
char errbuf[1024];
- ERROR ("opendir (%s): %s", dir,
+ ERROR ("plugin_load: opendir (%s) failed: %s", dir,
sstrerror (errno, errbuf, sizeof (errbuf)));
return (-1);
}
"%s/%s", dir, de->d_name);
if ((status < 0) || ((size_t) status >= sizeof (filename)))
{
- WARNING ("snprintf: truncated: `%s/%s'", dir, de->d_name);
+ WARNING ("plugin_load: Filename too long: \"%s/%s\"",
+ dir, de->d_name);
continue;
}
if (lstat (filename, &statbuf) == -1)
{
char errbuf[1024];
- WARNING ("stat %s: %s", filename,
+ WARNING ("plugin_load: stat (\"%s\") failed: %s",
+ filename,
sstrerror (errno, errbuf, sizeof (errbuf)));
continue;
}
else if (!S_ISREG (statbuf.st_mode))
{
/* don't follow symlinks */
- WARNING ("stat %s: not a regular file", filename);
+ WARNING ("plugin_load: %s is not a regular file.",
+ filename);
continue;
}
- if (plugin_load_file (filename, flags) == 0)
+ status = plugin_load_file (filename, flags);
+ if (status == 0)
{
/* success */
ret = 0;
}
else
{
- fprintf (stderr, "Unable to load plugin %s.\n", type);
+ ERROR ("plugin_load: Load plugin \"%s\" failed with "
+ "status %i.", type, status);
}
}
closedir (dh);
- if (filename[0] == '\0')
- fprintf (stderr, "Could not find plugin %s.\n", type);
+ if (filename[0] == 0)
+ ERROR ("plugin_load: Could not find plugin \"%s\" in %s",
+ type, dir);
return (ret);
}