From a07f44c9cd5828a84545dcfe22544bfed2ea8812 Mon Sep 17 00:00:00 2001 From: =?utf8?q?F=E1=B4=80=CA=99=C9=AA=E1=B4=87=C9=B4=20W=E1=B4=87=CA=80?= =?utf8?q?=C9=B4=CA=9F=C9=AA?= Date: Wed, 19 Jun 2019 10:32:11 +0200 Subject: [PATCH] Fix return value or loglevel for several plugins Some plugins' RC was != 0 and started to fail due to stricter verification introduced by 3b9c7b2. This commit fixes those return values. For some plugins, fix verbosity of error message: non-zero rc should be error, not warning. Change-Id: I9a3f1f80e266858b6744fd9d9d99b352b8d94306 Change-Id: Ibf6ebc6cdc93c6e105d488e4a131dcb6e8eea19b Change-Id: I35bac15fa0a89b068575739ac1cff0115c9d3a40 s Change-Id: I992002c56763fbdea5347e5b6e176cc86f5a08ce --- src/barometer.c | 2 +- src/load.c | 4 +++- src/logfile.c | 4 ++-- src/openvpn.c | 2 +- src/syslog.c | 1 + src/ted.c | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/barometer.c b/src/barometer.c index 468a2371..6e8eacda 100644 --- a/src/barometer.c +++ b/src/barometer.c @@ -1309,7 +1309,7 @@ static int collectd_barometer_config(const char *key, const char *value) { } else if (strcasecmp(key, "Normalization") == 0) { int normalize_tmp = atoi(value); if (normalize_tmp < 0 || normalize_tmp > 2) { - WARNING("barometer: collectd_barometer_config: invalid normalization: %d", + ERROR("barometer: collectd_barometer_config: invalid normalization: %d", normalize_tmp); return 1; } diff --git a/src/load.c b/src/load.c index da7fe58f..1adc6218 100644 --- a/src/load.c +++ b/src/load.c @@ -61,7 +61,7 @@ static const char *config_keys[] = {"ReportRelative"}; static int config_keys_num = STATIC_ARRAY_SIZE(config_keys); static int load_config(const char *key, const char *value) { - if (strcasecmp(key, "ReportRelative") == 0) + if (strcasecmp(key, "ReportRelative") == 0) { #ifdef _SC_NPROCESSORS_ONLN report_relative_load = IS_TRUE(value); #else @@ -69,6 +69,8 @@ static int load_config(const char *key, const char *value) { "is not available, because I can't determine the " "number of CPUS on this system. Sorry."); #endif + return 0; + } return -1; } static void load_submit(gauge_t snum, gauge_t mnum, gauge_t lnum) { diff --git a/src/logfile.c b/src/logfile.c index 3a25319e..ef75052a 100644 --- a/src/logfile.c +++ b/src/logfile.c @@ -52,8 +52,8 @@ static int logfile_config(const char *key, const char *value) { log_level = parse_log_severity(value); if (log_level < 0) { log_level = LOG_INFO; - ERROR("logfile: invalid loglevel [%s] defaulting to 'info'", value); - return 1; + WARNING("logfile: invalid loglevel [%s] defaulting to 'info'", value); + return 0; } } else if (0 == strcasecmp(key, "File")) { sfree(log_file); diff --git a/src/openvpn.c b/src/openvpn.c index 4d4a878f..10a42592 100644 --- a/src/openvpn.c +++ b/src/openvpn.c @@ -506,7 +506,7 @@ static int openvpn_config(const char *key, const char *value) { }); if (status == EINVAL) { - WARNING("openvpn plugin: status filename \"%s\" " + ERROR("openvpn plugin: status filename \"%s\" " "already used, please choose a " "different one.", status_name); diff --git a/src/syslog.c b/src/syslog.c index a600f30e..e8c4be56 100644 --- a/src/syslog.c +++ b/src/syslog.c @@ -56,6 +56,7 @@ static int sl_config(const char *key, const char *value) { } else if (strcasecmp(key, "NotifyLevel") == 0) { notif_severity = parse_notif_severity(value); if (notif_severity < 0) + ERROR("syslog: invalid notification severity [%s]", value); return 1; } diff --git a/src/ted.c b/src/ted.c index e1b48fd6..ff650a8d 100644 --- a/src/ted.c +++ b/src/ted.c @@ -243,7 +243,7 @@ static int ted_config(const char *key, const char *value) { tmp = atoi(value); if (tmp < 0) { - WARNING("ted plugin: Invalid retry count: %i", tmp); + ERROR("ted plugin: Invalid retry count: %i", tmp); return 1; } conf_retries = tmp; -- 2.11.0