X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fvirt.c;h=e5a8725381d2cf56a7e3e4ea01ddff6481276d82;hb=354f9991530248e45207d236eb74c1cc3d5238ef;hp=c9355c4a1cd961417ce8611befb2c1454c488bfe;hpb=3aeca36659b04725028f123bcea387a37581624a;p=collectd.git diff --git a/src/virt.c b/src/virt.c index c9355c4a..e5a87253 100644 --- a/src/virt.c +++ b/src/virt.c @@ -128,7 +128,7 @@ enum plginst_field { }; static enum plginst_field plugin_instance_format[PLGINST_MAX_FIELDS] = - { plginst_name }; + { plginst_none }; /* InterfaceFormat. */ enum if_field { @@ -449,7 +449,10 @@ lv_config (const char *key, const char *value) } for (i = 0; i < n; ++i) { - if (strcasecmp (fields[i], "name") == 0) + if (strcasecmp (fields[i], "none") == 0) { + plugin_instance_format[i] = plginst_none; + break; + } else if (strcasecmp (fields[i], "name") == 0) plugin_instance_format[i] = plginst_name; else if (strcasecmp (fields[i], "uuid") == 0) plugin_instance_format[i] = plginst_uuid; @@ -683,8 +686,8 @@ refresh_lists (void) int *domids; /* Get list of domains. */ - domids = malloc (sizeof (int) * n); - if (domids == 0) { + domids = malloc (sizeof (*domids) * n); + if (domids == NULL) { ERROR (PLUGIN_NAME " plugin: malloc failed."); return -1; } @@ -830,7 +833,7 @@ refresh_lists (void) } static void -free_domains () +free_domains (void) { int i; @@ -863,7 +866,7 @@ add_domain (virDomainPtr dom) } static void -free_block_devices () +free_block_devices (void) { int i; @@ -903,7 +906,7 @@ add_block_device (virDomainPtr dom, const char *path) } static void -free_interface_devices () +free_interface_devices (void) { int i;