dpdkstat: don't close already closed fd on failure
[collectd.git] / src / interface.c
index b8cc48d..b7c6f90 100644 (file)
@@ -155,18 +155,16 @@ static int interface_init(void) {
 
 static void if_submit(const char *dev, const char *type, derive_t rx,
                       derive_t tx) {
-  value_t values[2];
   value_list_t vl = VALUE_LIST_INIT;
+  value_t values[] = {
+      {.derive = rx}, {.derive = tx},
+  };
 
   if (ignorelist_match(ignorelist, dev) != 0)
     return;
 
-  values[0].derive = rx;
-  values[1].derive = tx;
-
   vl.values = values;
-  vl.values_len = 2;
-  sstrncpy(vl.host, hostname_g, sizeof(vl.host));
+  vl.values_len = STATIC_ARRAY_SIZE(values);
   sstrncpy(vl.plugin, "interface", sizeof(vl.plugin));
   sstrncpy(vl.plugin_instance, dev, sizeof(vl.plugin_instance));
   sstrncpy(vl.type, type, sizeof(vl.type));