Fix initstepslew with no sources specified (John Hasler)

This commit is contained in:
richard 2003-09-19 22:44:06 +00:00 committed by Richard P. Curnow
parent 712132f635
commit e3dd17c763
3 changed files with 15 additions and 11 deletions

1
NEWS
View file

@ -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
===================

5
README
View file

@ -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

20
conf.c
View file

@ -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);
}
}
/* ================================================== */