]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Fix initstepslew with no sources specified (John Hasler)
authorrichard <richard>
Fri, 19 Sep 2003 22:44:06 +0000 (22:44 +0000)
committerRichard P. Curnow <rc@rc0.org.uk>
Thu, 19 Jan 2006 21:37:13 +0000 (21:37 +0000)
NEWS
README
conf.c

diff --git a/NEWS b/NEWS
index 420b4ec2ccc7048aa5dc4f25992affc2188696ae..6903ab62e442e3ada3d2cd385d7b874d52621bcc 100644 (file)
--- 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 4846ec8fc874aadce7a5135f6ec9009b9f5a7f0f..565f954ed4aaa964d7885e013d5e5f4ad30ad945 100644 (file)
--- a/README
+++ b/README
@@ -193,7 +193,8 @@ Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
 
 John Hasler <john@dhh.gt.org>
     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 <me@liamhatton.com>
     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 48f9436a02a264bfa2ad28369db0461ba53a7c91..d7aae3c35f98ee05fe7e9233ac3d2c6a329d3ec3 100644 (file)
--- 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);
+  }
 }
 
 /* ================================================== */