From: Florian Forster Date: Sat, 25 Feb 2012 16:12:45 +0000 (+0100) Subject: src/plugin.c: Fix use of strcmp(). X-Git-Tag: collectd-5.1.0~22 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e101bb5da4c66686aac12a55e757c8ecd4522a8e;p=collectd.git src/plugin.c: Fix use of strcmp(). Change-Id: I078ca80ba6e3cac413186c2ad063d32cdfbb398e --- diff --git a/src/plugin.c b/src/plugin.c index fac4d779..cdd56bd7 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -1733,12 +1733,12 @@ int parse_notif_severity (const char *severity) { int notif_severity = -1; - if (strcasecmp (severity, "FAILURE")) + if (strcasecmp (severity, "FAILURE") == 0) notif_severity = NOTIF_FAILURE; - else if (strcmp (severity, "OKAY")) + else if (strcmp (severity, "OKAY") == 0) notif_severity = NOTIF_OKAY; - else if ((strcmp (severity, "WARNING")) - || (strcmp (severity, "WARN"))) + else if ((strcmp (severity, "WARNING") == 0) + || (strcmp (severity, "WARN") == 0)) notif_severity = NOTIF_WARNING; return (notif_severity); diff --git a/src/plugin.h b/src/plugin.h index 56f927be..dd65b598 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -325,6 +325,8 @@ int plugin_dispatch_notification (const notification_t *notif); void plugin_log (int level, const char *format, ...) __attribute__ ((format(printf,2,3))); + +/* These functions return the parsed severity or less than zero on failure. */ int parse_log_severity (const char *severity); int parse_notif_severity (const char *severity);