[Nagiosplug-devel] Patch: check_time returns OK if time is beforeor equal 1.1.1970

Thomas Guyot-Sionnest Thomas at zango.com
Tue May 1 16:56:13 CEST 2007


> -----Original Message-----
> From: nagiosplug-devel-bounces at lists.sourceforge.net 
> [mailto:nagiosplug-devel-bounces at lists.sourceforge.net] On 
> Behalf Of Matthias Flacke
> Sent: May 1, 2007 10:15
> To: nagiosplug-devel at lists.sourceforge.net
> Subject: [Nagiosplug-devel] Patch: check_time returns OK if 
> time is beforeor equal 1.1.1970
> 
> Hello list,
> 
> if a machine - perhaps due to a crash - gets a date before 1970 
> check_time returns a wrong OK result even if the diff_time seems to be
> reasonable:
> 
> $ date
> Thu Jan  1 00:01:01 CET 1970
> $ ./check_time -w 5 -c 10 -H ntp1.fau.de
> TIME OK - 3116935377 second time difference|time=0s;;;0 
> offset=-1178031919s;5;10;0
> 
> The problem lies in the signed var diff_time which can get 
> negative and
> then for sure is smaller than the positive thresholds warning_diff or 
> critical_diff.
> 
> A small patch changes time_t diff_time into uint32_t and 
> works fine for 
> me.

Nice one, thanks!

Will commit tonight if nobody beat me at it.

Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3076 bytes
Desc: not available
URL: <http://nagios-plugins.org/archive/devel/attachments/20070501/dd541c0e/attachment.bin>


More information about the Devel mailing list