[Nagiosplug-checkins] nagiosplug/plugins check_time.c,1.29,1.30

Thomas Guyot dermoth at users.sourceforge.net
Wed May 2 07:22:33 CEST 2007


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs16:/tmp/cvs-serv27883/plugins

Modified Files:
	check_time.c 
Log Message:
Fix check_time returning wrong OK when time is before the epoch on some arch


Index: check_time.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_time.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- check_time.c	28 Jan 2007 21:46:40 -0000	1.29
+++ check_time.c	2 May 2007 05:22:30 -0000	1.30
@@ -49,8 +49,8 @@
 
 #define	UNIX_EPOCH 2208988800UL
 
-uint32_t server_time, raw_server_time;
-time_t diff_time;
+uint32_t raw_server_time;
+unsigned long server_time, diff_time;
 int warning_time = 0;
 int check_warning_time = FALSE;
 int critical_time = 0;
@@ -166,9 +166,9 @@
 	else
 		diff_time = (unsigned long)end_time - server_time;
 
-	if (check_critical_diff == TRUE && diff_time > (time_t)critical_diff)
+	if (check_critical_diff == TRUE && diff_time > critical_diff)
 		result = STATE_CRITICAL;
-	else if (check_warning_diff == TRUE && diff_time > (time_t)warning_diff)
+	else if (check_warning_diff == TRUE && diff_time > warning_diff)
 		result = STATE_WARNING;
 
 	printf (_("TIME %s - %lu second time difference|%s %s\n"),
@@ -177,9 +177,9 @@
 	                  check_warning_time, (long)warning_time,
 	                  check_critical_time, (long)critical_time,
 	                  TRUE, 0, FALSE, 0),
-	        perfdata ("offset", (long)diff_time, "s",
-	                  check_warning_diff, (long)warning_diff,
-	                  check_critical_diff, (long)critical_diff,
+	        perfdata ("offset", diff_time, "s",
+	                  check_warning_diff, warning_diff,
+	                  check_critical_diff, critical_diff,
 	                  TRUE, 0, FALSE, 0));
 	return result;
 }





More information about the Commits mailing list