[Nagiosplug-checkins] nagiosplug/plugins check_ping.c,1.54,1.55

Thomas Guyot dermoth at users.sourceforge.net
Sat Jan 6 05:53:01 CET 2007


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv26254/plugins

Modified Files:
	check_ping.c 
Log Message:
Fix the way check_ping calculate the maximum run time


Index: check_ping.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ping.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- check_ping.c	4 Jan 2007 11:35:56 -0000	1.54
+++ check_ping.c	6 Jan 2007 04:52:58 -0000	1.55
@@ -399,7 +399,11 @@
 	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;
 





More information about the Commits mailing list