diff options
| author | 2019-11-10 07:32:58 +0000 | |
|---|---|---|
| committer | 2019-11-10 07:32:58 +0000 | |
| commit | fe63d0d1b7bea470af1ea41adf0bc5edab19b1f1 (patch) | |
| tree | 2b36ae4fc36310290015374e6678fd483f2cdbb7 /usr.sbin/ntpd/ntp.c | |
| parent | Change the EINVAL return code to a KASSERT if the namei structure is (diff) | |
| download | wireguard-openbsd-fe63d0d1b7bea470af1ea41adf0bc5edab19b1f1.tar.xz wireguard-openbsd-fe63d0d1b7bea470af1ea41adf0bc5edab19b1f1.zip | |
- validate sensor values against constraints
- do not restart settime timeout interval if something happens in the main
event loop
- apply a tight loop protection; it can be painfull on a single
core machine since the process runs at maximum priority. Should only
happen when a bug is introduced while developing, but prevents having to
machine taken over by ntpd.
Diffstat (limited to 'usr.sbin/ntpd/ntp.c')
| -rw-r--r-- | usr.sbin/ntpd/ntp.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c index 8127498802d..d8bb26e9227 100644 --- a/usr.sbin/ntpd/ntp.c +++ b/usr.sbin/ntpd/ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp.c,v 1.159 2019/07/16 14:15:40 otto Exp $ */ +/* $OpenBSD: ntp.c,v 1.160 2019/11/10 07:32:58 otto Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -298,7 +298,8 @@ ntp_main(struct ntpd_conf *nconf, struct passwd *pw, int argc, char **argv) } idx_clients = i; - if (!TAILQ_EMPTY(&conf->ntp_conf_sensors)) { + if (!TAILQ_EMPTY(&conf->ntp_conf_sensors) && + (constraint_cnt == 0 || conf->constraint_median != 0)) { if (last_sensor_scan == 0 || last_sensor_scan + SENSOR_SCAN_INTERVAL <= getmonotime()) { sensors_cnt = sensor_scan(); @@ -346,7 +347,7 @@ ntp_main(struct ntpd_conf *nconf, struct passwd *pw, int argc, char **argv) if (timeout < 0) timeout = 0; - if ((nfds = poll(pfd, i, timeout * 1000)) == -1) + if ((nfds = poll(pfd, i, timeout ? timeout * 1000 : 1)) == -1) if (errno != EINTR) { log_warn("poll error"); ntp_quit = 1; |
