[Nagiosplug-devel] Patch: check_time returns OK if time is before or equal 1.1.1970
Matthias Flacke
matthias.flacke at stiegemeyer.de
Tue May 1 16:15:04 CEST 2007
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.
Best regards,
Matthias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check_time.c.patch
Type: application/octet-stream
Size: 361 bytes
Desc: not available
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20070501/a88f62b5/attachment.obj>
More information about the Devel
mailing list