From: Michael Friedrich Date: Wed, 10 Jul 2019 09:51:58 +0000 (+0200) Subject: Fix compiler warnings and style X-Git-Tag: v2.11.0-rc1~32^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a3c67973103e01f686f02785f2f14b5318a0acf0;p=icinga2 Fix compiler warnings and style --- diff --git a/lib/icinga/checkable-check.cpp b/lib/icinga/checkable-check.cpp index 90c6395e1..7b095353a 100644 --- a/lib/icinga/checkable-check.cpp +++ b/lib/icinga/checkable-check.cpp @@ -461,7 +461,7 @@ void Checkable::ProcessCheckResult(const CheckResult::Ptr& cr, const MessageOrig for (int conflict : {NotificationProblem | NotificationRecovery, NotificationFlappingStart | NotificationFlappingEnd}) { /* E.g. problem and recovery notifications neutralize each other. */ - if (suppressed_types_after & conflict == conflict) { + if ((suppressed_types_after & conflict) == conflict) { suppressed_types_after &= ~conflict; } } diff --git a/lib/icinga/checkable-notification.cpp b/lib/icinga/checkable-notification.cpp index a6475b87f..78c488dfe 100644 --- a/lib/icinga/checkable-notification.cpp +++ b/lib/icinga/checkable-notification.cpp @@ -110,30 +110,38 @@ static void FireSuppressedNotifications(Checkable* checkable) auto cr (checkable->GetLastCheckResult()); switch (type) { - case NotificationProblem: - still_applies = cr && !checkable->IsStateOK(cr->GetState()) && checkable->GetStateType() == StateTypeHard; - break; - case NotificationRecovery: - still_applies = cr && checkable->IsStateOK(cr->GetState()); - break; - case NotificationFlappingStart: - still_applies = checkable->IsFlapping(); - break; - case NotificationFlappingEnd: - still_applies = !checkable->IsFlapping(); + case NotificationProblem: + still_applies = cr && !checkable->IsStateOK(cr->GetState()) && checkable->GetStateType() == StateTypeHard; + break; + case NotificationRecovery: + still_applies = cr && checkable->IsStateOK(cr->GetState()); + break; + case NotificationFlappingStart: + still_applies = checkable->IsFlapping(); + break; + case NotificationFlappingEnd: + still_applies = !checkable->IsFlapping(); + break; + default: + break; } if (still_applies) { bool still_suppressed; switch (type) { - case NotificationProblem: - case NotificationRecovery: - still_suppressed = !checkable->IsReachable(DependencyNotification) || checkable->IsInDowntime() || checkable->IsAcknowledged(); - break; - case NotificationFlappingStart: - case NotificationFlappingEnd: - still_suppressed = checkable->IsInDowntime(); + case NotificationProblem: + /* Fall through. */ + case NotificationRecovery: + still_suppressed = !checkable->IsReachable(DependencyNotification) || checkable->IsInDowntime() || checkable->IsAcknowledged(); + break; + case NotificationFlappingStart: + /* Fall through. */ + case NotificationFlappingEnd: + still_suppressed = checkable->IsInDowntime(); + break; + default: + break; } if (!still_suppressed && checkable->GetEnableActiveChecks()) { @@ -169,6 +177,7 @@ static void FireSuppressedNotifications(Checkable* checkable) if (subtract) { ObjectLock olock (checkable); + int suppressed_types_before (checkable->GetSuppressedNotifications()); int suppressed_types_after (suppressed_types_before & ~subtract);