Merge pull request #2121 from octo/netapp
authorFlorian Forster <ff@octo.it>
Thu, 22 Dec 2016 08:13:52 +0000 (09:13 +0100)
committerGitHub <noreply@github.com>
Thu, 22 Dec 2016 08:13:52 +0000 (09:13 +0100)
netapp plugin: Fix complation problems.

src/Makefile.am
src/battery.c
src/dpdkstat.c

index bd6d901..bec7ca9 100644 (file)
@@ -444,7 +444,8 @@ endif
 if BUILD_PLUGIN_EXEC
 pkglib_LTLIBRARIES += exec.la
 exec_la_SOURCES = exec.c
-exec_la_LDFLAGS = $(PLUGIN_LDFLAGS) libcmds.la
+exec_la_LDFLAGS = $(PLUGIN_LDFLAGS)
+exec_la_LIBADD = libcmds.la
 endif
 
 if BUILD_PLUGIN_ETHSTAT
@@ -1217,7 +1218,8 @@ endif
 if BUILD_PLUGIN_UNIXSOCK
 pkglib_LTLIBRARIES += unixsock.la
 unixsock_la_SOURCES = unixsock.c
-unixsock_la_LDFLAGS = $(PLUGIN_LDFLAGS) libcmds.la
+unixsock_la_LDFLAGS = $(PLUGIN_LDFLAGS)
+unixsock_la_LIBADD =  libcmds.la
 endif
 
 if BUILD_PLUGIN_UPTIME
index 5c02fee..78e96b2 100644 (file)
@@ -350,10 +350,12 @@ static int sysfs_file_to_buffer(char const *dir, /* {{{ */
   ssnprintf(filename, sizeof(filename), "%s/%s/%s", dir, power_supply,
             basename);
 
-  status = (int)read_file_contents(filename, buffer, buffer_size);
+  status = (int)read_file_contents(filename, buffer, buffer_size - 1);
   if (status < 0)
     return status;
 
+  buffer[status] = '\0';
+
   strstripnewline(buffer);
   return 0;
 } /* }}} int sysfs_file_to_buffer */
@@ -364,7 +366,7 @@ static int sysfs_file_to_gauge(char const *dir, /* {{{ */
                                char const *power_supply, char const *basename,
                                gauge_t *ret_value) {
   int status;
-  char buffer[32] = "";
+  char buffer[32];
 
   status =
       sysfs_file_to_buffer(dir, power_supply, basename, buffer, sizeof(buffer));
index de75c0c..2686be1 100644 (file)
@@ -159,8 +159,8 @@ static int dpdk_shm_init(size_t size);
 static void dpdk_config_init_default(void) {
   g_configuration->interval = plugin_get_interval();
   if (g_configuration->interval == cf_get_default_interval())
-    WARNING("dpdkstat: No time interval was configured, default value %lu ms "
-            "is set",
+    WARNING("dpdkstat: No time interval was configured, default value %" PRIu64
+            " ms is set",
             CDTIME_T_TO_MS(g_configuration->interval));
   /* Default is all ports enabled */
   g_configuration->enabled_port_mask = ~0;
@@ -289,13 +289,13 @@ static int dpdk_shm_init(size_t size) {
   if (err) {
     ERROR("dpdkstat semaphore init failed: %s",
           sstrerror(errno, errbuf, sizeof(errbuf)));
-    goto fail_close;
+    goto close;
   }
   err = sem_init(&g_configuration->sema_stats_in_shm, 1, 0);
   if (err) {
     ERROR("dpdkstat semaphore init failed: %s",
           sstrerror(errno, errbuf, sizeof(errbuf)));
-    goto fail_close;
+    goto close;
   }
 
   g_configuration->xstats = NULL;
@@ -413,7 +413,7 @@ static int dpdk_helper_spawn(enum DPDK_HELPER_ACTION action) {
   if (pid > 0) {
     close(g_configuration->helper_pipes[1]);
     g_configuration->helper_pid = pid;
-    DEBUG("dpdkstat: helper pid %lu", (long)g_configuration->helper_pid);
+    DEBUG("dpdkstat: helper pid %li", (long)g_configuration->helper_pid);
     /* Kick helper once its alive to have it start processing */
     sem_post(&g_configuration->sema_helper_get_stats);
   } else if (pid == 0) {