From: Harlan Stenn Date: Sat, 23 Nov 2013 22:08:57 +0000 (-0800) Subject: [Bug 2326] More leapsecond file notification cleanup X-Git-Tag: NTP_4_2_7P398~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7ffb477619d44d5683cb27946988d6fd1c9b76f;p=thirdparty%2Fntp.git [Bug 2326] More leapsecond file notification cleanup bk: 52912779gMNTeEaXV_DVhQTawqp1dA --- diff --git a/ChangeLog b/ChangeLog index cd6608d25..54f3688c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +* [Bug 2326] More leapsecond file notification cleanup. +* Improve sntp KoD data file fopen() error message. (4.2.7p397) 2013/11/20 Released by Harlan Stenn * [Bug 2326] More leapsecond file notification cleanup. (4.2.7p396) 2013/11/19 Released by Harlan Stenn diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index cd4d871cb..fde2baf43 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -3717,7 +3717,7 @@ input_handler( #ifdef DEBUG if (debug) msyslog(LOG_DEBUG, "input_handler: select() returned 0"); -#endif +#endif /* DEBUG */ goto ih_return; } /* We've done our work */ @@ -3734,22 +3734,39 @@ input_handler( msyslog(LOG_DEBUG, "input_handler: Processed a gob of fd's in %s msec", lfptoms(&ts_e, 6)); -#endif +#endif /* DEBUG_TIMING */ /* We're done... */ ih_return: if (check_leapfile < time(NULL)) { - int rc; + int clf; check_leapfile += CHECK_LEAP_EVERY; - rc = check_leap_file(); + clf = check_leap_file(); - if (rc < 31) - msyslog(LOG_DEBUG, - "input_handler: check_leap_file() returned %d.' time!", rc); + /* + ** check_leap_file() returns -1 on a problem, + ** 0 on an expired leapsecond file, or the number + ** of days until the leapsecond file expires. + */ + if (-1 == clf) { + /* nothing to do */ + } else if (0 == clf) { + /* XXX: Do we want to report_event() here? */ + // report_event(EVNT_LEAPVAL, NULL, NULL); + if (leap_warn_log == FALSE) { + msyslog(LOG_WARNING, + "input_handler: leapseconds data file <%s> has expired!", + leapseconds_file); + leap_warn_log = TRUE; + } + } else if (clf < 31) { + msyslog(LOG_WARNING, + "input_handler: leapseconds data file <%s> will expire in less than %d days' time.", leapseconds_file, clf); + } } return; } -#endif /* HAVE_IO_COMPLETION_PORT */ +#endif /* !HAVE_IO_COMPLETION_PORT */ /* diff --git a/ntpd/ntp_timer.c b/ntpd/ntp_timer.c index ee2575705..129d75cd8 100644 --- a/ntpd/ntp_timer.c +++ b/ntpd/ntp_timer.c @@ -436,12 +436,13 @@ timer(void) report_event(EVNT_LEAPVAL, NULL, NULL); if (leap_warn_log == FALSE) { msyslog(LOG_WARNING, - "timer: leapseconds data file has expired!"); + "timer: leapseconds data file <%s> has expired!", + leapseconds_file); leap_warn_log = TRUE; } } else if (clf < 31) { msyslog(LOG_WARNING, - "timer: leapseconds data file will expire in about %d days' time!", clf); + "timer: leapseconds data file <%s> will expire in less than %d days' time.", leapseconds_file, clf); } } else leap_warn_log = FALSE;