From 273aa6f99784d1056b391b8a95409c67b8f34f10 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 19 Jun 2023 12:46:40 +0200 Subject: [PATCH] IcingaDB::PrepareObject(): round Notification#interval and limit it to >=0 otherwise, e.g. with -42.5, the Go daemon crashes. It expects uints there. --- lib/icingadb/icingadb-objects.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/icingadb/icingadb-objects.cpp b/lib/icingadb/icingadb-objects.cpp index 7a306c35ac7..116c4645b41 100644 --- a/lib/icingadb/icingadb-objects.cpp +++ b/lib/icingadb/icingadb-objects.cpp @@ -32,6 +32,7 @@ #include "remote/zone.hpp" #include #include +#include #include #include #include @@ -1387,7 +1388,7 @@ bool IcingaDB::PrepareObject(const ConfigObject::Ptr& object, Dictionary::Ptr& a attributes->Set("times_end",notification->GetTimes()->Get("end")); } - attributes->Set("notification_interval", notification->GetInterval()); + attributes->Set("notification_interval", std::max(0.0, std::round(notification->GetInterval()))); attributes->Set("states", notification->GetStates()); attributes->Set("types", notification->GetTypes());