From a61a5ead01afeb3eeaf49cfe57978298bd2b9aa6 Mon Sep 17 00:00:00 2001
From: Thomas Guyot-Sionnest <dermoth@users.sourceforge.net>
Date: Sat, 6 Jan 2007 04:52:58 +0000
Subject: Fix the way check_ping calculate the maximum run time

git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1561 f882894a-f735-0410-b71e-b25c423dba1c

diff --git a/plugins/check_ping.c b/plugins/check_ping.c
index eb3a6db..a4efc6c 100644
--- a/plugins/check_ping.c
+++ b/plugins/check_ping.c
@@ -399,7 +399,11 @@ validate_arguments ()
 	if (max_packets == -1)
 		max_packets = DEFAULT_MAX_PACKETS;
 
-	max_seconds = crta / 1000.0 * max_packets + max_packets;
+	max_seconds = crta * max_packets;
+	/* Round up max_seconds because we use only the int part */
+	if (max_seconds != (int)max_seconds)
+		max_seconds = (int)max_seconds + 1;
+
 	if (max_seconds > timeout_interval)
 		timeout_interval = (int)max_seconds;
 
-- 
cgit v0.10-9-g596f

