From e101bb5da4c66686aac12a55e757c8ecd4522a8e Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sat, 25 Feb 2012 17:12:45 +0100 Subject: [PATCH] src/plugin.c: Fix use of strcmp(). Change-Id: I078ca80ba6e3cac413186c2ad063d32cdfbb398e --- src/plugin.c | 8 ++++---- src/plugin.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) 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); -- 2.30.2