summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d09ec85)
raw | patch | inline | side by side (parent: d09ec85)
author | Florian Forster <octo@collectd.org> | |
Thu, 18 Jun 2015 11:36:02 +0000 (13:36 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Thu, 18 Jun 2015 11:36:02 +0000 (13:36 +0200) |
src/collectd.c | patch | blob | history | |
src/configfile.c | patch | blob | history | |
src/df.c | patch | blob | history | |
src/libvirt.c | patch | blob | history | |
src/table.c | patch | blob | history |
diff --git a/src/collectd.c b/src/collectd.c
index d25975308e9689b15fa9126503f35ed056353a67..6815cccfd80f2af49e34f6215db737dcac9543ea 100644 (file)
--- a/src/collectd.c
+++ b/src/collectd.c
static int pidfile_remove (void)
{
const char *file = global_option_get ("PIDFile");
+ if (file == NULL)
+ return 0;
- DEBUG ("unlink (%s)", (file != NULL) ? file : "<null>");
return (unlink (file));
} /* static int pidfile_remove (const char *file) */
#endif /* COLLECT_DAEMON */
diff --git a/src/configfile.c b/src/configfile.c
index a337c6f5724b450819a6ad24686633e3f0e7f991..c389ad1676a3d2948dd806da979ac5f1ee9f88c5 100644 (file)
--- a/src/configfile.c
+++ b/src/configfile.c
int ret;
int i;
+ if (orig_key == NULL)
+ return (EINVAL);
+
DEBUG ("type = %s, key = %s, value = %s",
ESCAPE_NULL(type),
- ESCAPE_NULL(orig_key),
+ orig_key,
ESCAPE_NULL(orig_value));
if ((cf_cb = cf_search (type)) == NULL)
free (key);
free (value);
- DEBUG ("cf_dispatch: return (%i)", ret);
-
return (ret);
} /* int cf_dispatch */
filenames[filenames_num - 1] = sstrdup (name);
}
+ if (filenames == NULL)
+ return (root);
+
qsort ((void *) filenames, filenames_num, sizeof (*filenames),
cf_compare_string);
diff --git a/src/df.c b/src/df.c
index 3d5a402c7949b8741b7568b78d987c1fe033dc6a..ae09e6b7cfee834d69de231dda572993f056873e 100644 (file)
--- a/src/df.c
+++ b/src/df.c
uint64_t blk_reserved;
uint64_t blk_used;
- if (ignorelist_match (il_device,
- (mnt_ptr->spec_device != NULL)
- ? mnt_ptr->spec_device
- : mnt_ptr->device))
+ char const *dev = (mnt_ptr->spec_device != NULL)
+ ? mnt_ptr->spec_device
+ : mnt_ptr->device;
+
+ if (ignorelist_match (il_device, dev))
continue;
if (ignorelist_match (il_mountpoint, mnt_ptr->dir))
continue;
if (by_device)
{
/* eg, /dev/hda1 -- strip off the "/dev/" */
- if (strncmp (mnt_ptr->spec_device, "/dev/", strlen ("/dev/")) == 0)
- sstrncpy (disk_name, mnt_ptr->spec_device + strlen ("/dev/"), sizeof (disk_name));
+ if (strncmp (dev, "/dev/", strlen ("/dev/")) == 0)
+ sstrncpy (disk_name, dev + strlen ("/dev/"), sizeof (disk_name));
else
- sstrncpy (disk_name, mnt_ptr->spec_device, sizeof (disk_name));
+ sstrncpy (disk_name, dev, sizeof (disk_name));
if (strlen(disk_name) < 1)
{
diff --git a/src/libvirt.c b/src/libvirt.c
index 87b71e698b93c894a3c4cdabde0e218144ed083d..6a397db3e5285829f0739ec2f1f3960e0b6362fa 100644 (file)
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -798,6 +798,9 @@ add_interface_device (virDomainPtr dom, const char *path, const char *address, u
int new_size = sizeof (interface_devices[0]) * (nr_interface_devices+1);
char *path_copy, *address_copy, number_string[15];
+ if ((path == NULL) || (address == NULL))
+ return EINVAL;
+
path_copy = strdup (path);
if (!path_copy) return -1;
@@ -833,6 +836,9 @@ ignore_device_match (ignorelist_t *il, const char *domname, const char *devpath)
char *name;
int n, r;
+ if ((domname == NULL) || (devpath == NULL))
+ return 0;
+
n = sizeof (char) * (strlen (domname) + strlen (devpath) + 2);
name = malloc (n);
if (name == NULL) {
diff --git a/src/table.c b/src/table.c
index 9641c759b2b059a010492b39d6e583196b8038fd..a3bacc7ae6e73b2e7f7b587f25833a9cd9374e7a 100644 (file)
--- a/src/table.c
+++ b/src/table.c
if (NULL == tbl->sep) {
log_err ("Table \"%s\" does not specify any separator.", tbl->file);
status = 1;
+ } else {
+ strunescape (tbl->sep, strlen (tbl->sep) + 1);
}
- strunescape (tbl->sep, strlen (tbl->sep) + 1);
if (NULL == tbl->instance) {
tbl->instance = sstrdup (tbl->file);