From: richard Date: Fri, 19 Sep 2003 22:44:06 +0000 (+0000) Subject: Fix initstepslew with no sources specified (John Hasler) X-Git-Tag: 1.20~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3dd17c763468abb787be764c57e49025a74107a;p=thirdparty%2Fchrony.git Fix initstepslew with no sources specified (John Hasler) --- diff --git a/NEWS b/NEWS index 420b4ec2..6903ab62 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,7 @@ New in version 1.20 * Add detection of Linux 2.5 * Allow arbitrary value of HZ in Linux kernel * Fix for chrony.spec on SuSE (Paul Elliot) +* Fix handling of initstepslew if no servers are listed (John Hasler) New in version 1.19 =================== diff --git a/README b/README index 4846ec8f..565f954e 100644 --- a/README +++ b/README @@ -193,7 +193,8 @@ Juergen Hannken-Illjes John Hasler Changes to support 64 bit machines (i.e. those where - sizeof(unsigned long) > 4) + sizeof(unsigned long) > 4) + Bug fix to initstepslew directive Liam Hatton Advice on configuring for Linux on PPC @@ -238,6 +239,6 @@ sorry I can't identify all of you individually. Version control information =========================== -$Header: /cvs/src/chrony/README,v 1.27 2003/07/01 20:56:23 richard Exp $ +$Header: /cvs/src/chrony/README,v 1.28 2003/09/19 22:44:06 richard Exp $ vim:tw=72 diff --git a/conf.c b/conf.c index 48f9436a..d7aae3c3 100644 --- a/conf.c +++ b/conf.c @@ -1,5 +1,5 @@ /* - $Header: /cvs/src/chrony/conf.c,v 1.42 2003/03/27 23:45:47 richard Exp $ + $Header: /cvs/src/chrony/conf.c,v 1.43 2003/09/19 22:44:06 richard Exp $ ======================================================================= @@ -570,20 +570,18 @@ parse_initstepslew(const char *line) const char *p; char hostname[HOSTNAME_LEN+1]; int n; + int threshold; unsigned long ip_addr; - do_init_stepslew = 1; n_init_srcs = 0; p = line; - if (sscanf(p, "%d%n", &init_slew_threshold, &n) == 1) { + if (sscanf(p, "%d%n", &threshold, &n) == 1) { p += n; } else { LOG(LOGS_WARN, LOGF_Configure, "Could not parse initstepslew threshold at line %d", line_number); - init_slew_threshold = -1; return; } - while (*p) { if (sscanf(p, "%" SHOSTNAME_LEN "s%n", hostname, &n) == 1) { ip_addr = DNS_Name2IPAddress(hostname); @@ -593,17 +591,21 @@ parse_initstepslew(const char *line) } if (n_init_srcs >= MAX_INIT_SRCS) { - return; + break; } } else { /* If we get invalid trailing syntax, forget it ... */ - return; + break; } - p += n; } - + if (n_init_srcs > 0) { + do_init_stepslew = 1; + init_slew_threshold = threshold; + } else { + LOG(LOGS_WARN, LOGF_Configure, "No usable initstepslew servers at line %d\n", line_number); + } } /* ================================================== */