sensu plugin: fix compiler warning when build with --enable-debug
authorRuben Kerkhof <ruben@rubenkerkhof.com>
Tue, 19 Feb 2019 17:53:19 +0000 (18:53 +0100)
committerRuben Kerkhof <ruben@rubenkerkhof.com>
Tue, 19 Feb 2019 17:54:54 +0000 (18:54 +0100)
In file included from src/write_sensu.c:31:
src/write_sensu.c: In function ‘sensu_config’:
./src/daemon/plugin.h:398:20: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
  398 | #define DEBUG(...) plugin_log(LOG_DEBUG, __VA_ARGS__)
      |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/write_sensu.c:1227:7: note: in expansion of macro ‘DEBUG’
 1227 |       DEBUG("write_sensu plugin: Got tag: %s", tmp);
      |       ^~~~~
src/write_sensu.c:1227:43: note: format string is defined here
 1227 |       DEBUG("write_sensu plugin: Got tag: %s", tmp);
      |

src/write_sensu.c

index 1bff27b..7d08fb5 100644 (file)
@@ -1221,10 +1221,10 @@ static int sensu_config(oconfig_item_t *ci) /* {{{ */
         continue;
 
       status = add_str_to_list(&sensu_tags_arr, tmp);
         continue;
 
       status = add_str_to_list(&sensu_tags_arr, tmp);
+      DEBUG("write_sensu plugin: Got tag: %s", tmp);
       sfree(tmp);
       if (status != 0)
         continue;
       sfree(tmp);
       if (status != 0)
         continue;
-      DEBUG("write_sensu plugin: Got tag: %s", tmp);
     } else {
       WARNING("write_sensu plugin: Ignoring unknown "
               "configuration option \"%s\" at top level.",
     } else {
       WARNING("write_sensu plugin: Ignoring unknown "
               "configuration option \"%s\" at top level.",