projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge pull request #1596 from rubenk/fix-a-few-more-prototypes
[collectd.git]
/
src
/
libvirt.c
diff --git
a/src/libvirt.c
b/src/libvirt.c
index
cfabaaa
..
4cbe38d
100644
(file)
--- a/
src/libvirt.c
+++ b/
src/libvirt.c
@@
-259,8
+259,8
@@
lv_init (void)
{
if (virInitialize () != 0)
return -1;
{
if (virInitialize () != 0)
return -1;
-
- return 0;
+ else
+
return 0;
}
static int
}
static int
@@
-441,6
+441,12
@@
lv_read (void)
continue;
}
continue;
}
+ if (info.state != VIR_DOMAIN_RUNNING)
+ {
+ /* only gather stats for running domains */
+ continue;
+ }
+
cpu_submit (info.cpuTime, domains[i], "virt_cpu_total");
memory_submit ((gauge_t) info.memory * 1024, domains[i]);
cpu_submit (info.cpuTime, domains[i], "virt_cpu_total");
memory_submit ((gauge_t) info.memory * 1024, domains[i]);
@@
-792,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];
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;
path_copy = strdup (path);
if (!path_copy) return -1;
@@
-827,6
+836,9
@@
ignore_device_match (ignorelist_t *il, const char *domname, const char *devpath)
char *name;
int n, r;
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) {
n = sizeof (char) * (strlen (domname) + strlen (devpath) + 2);
name = malloc (n);
if (name == NULL) {