summaryrefslogtreecommitdiff
path: root/usr.sbin/ntpd/sensors.c
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2006-05-27 17:01:08 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2006-05-27 17:01:08 +0000
commit954bd17cbd282d896c77f38d0772b325d0081e00 (patch)
tree6fa98e7aacf2506d58c4340ba36abb1c101d424d /usr.sbin/ntpd/sensors.c
parentb04951fd6041422bc43a447d598fa8479c25635d (diff)
config file bits for timedelta sensors, so one can specify which devices
to use. "sensors *" just uses all. untested due to lack of hardware. hacked on the road somewhere between vancouver and calgary
Diffstat (limited to 'usr.sbin/ntpd/sensors.c')
-rw-r--r--usr.sbin/ntpd/sensors.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/usr.sbin/ntpd/sensors.c b/usr.sbin/ntpd/sensors.c
index 21395dfcc4d..6213f5ca581 100644
--- a/usr.sbin/ntpd/sensors.c
+++ b/usr.sbin/ntpd/sensors.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sensors.c,v 1.1 2006/05/26 00:33:16 henning Exp $ */
+/* $OpenBSD: sensors.c,v 1.2 2006/05/27 17:01:07 henning Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@@ -68,12 +68,21 @@ void
sensor_add(struct ntpd_conf *conf, struct sensor *sensor)
{
struct ntp_sensor *s;
+ struct ntp_conf_sensor *cs;
/* check wether it is already there */
TAILQ_FOREACH(s, &conf->ntp_sensors, entry)
if (!strcmp(s->device, sensor->device))
return;
+ /* check wether it is requested in the config file */
+ for (cs = TAILQ_FIRST(&conf->ntp_conf_sensors); cs != NULL &&
+ strcmp(cs->device, sensor->device) && strcmp(cs->device, "*");
+ cs = TAILQ_NEXT(cs, entry))
+ ; /* nothing */
+ if (cs == NULL)
+ return;
+
if ((s = calloc(1, sizeof(*s))) == NULL)
fatal("sensor_add calloc");