summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2007-01-15 19:58:50 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2007-01-15 19:58:50 +0000
commit3a5e2d5cd5b7ca8d186e711132f0fd7d627e8df3 (patch)
tree376bb6c4e98ea09b5ef5d1c200d5932c5fc08675
parentd6cd40bea9bdf5057bdd055510772c505ba587d5 (diff)
the new sensors tre can give us the number of sensors per type.
With this patch, we give up without bothering sysctl kern_sensors.c::sensor_find() unless we know for sure that timedelta sensor is present. From: "Constantine A. Murenin" <cnst+openbsd@bugmail.mojo.ru>
-rw-r--r--usr.sbin/ntpd/sensors.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/ntpd/sensors.c b/usr.sbin/ntpd/sensors.c
index 1058a341c69..79f6da922be 100644
--- a/usr.sbin/ntpd/sensors.c
+++ b/usr.sbin/ntpd/sensors.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sensors.c,v 1.30 2007/01/15 08:19:11 otto Exp $ */
+/* $OpenBSD: sensors.c,v 1.31 2007/01/15 19:58:49 henning Exp $ */
/*
* Copyright (c) 2006 Henning Brauer <henning@openbsd.org>
@@ -76,6 +76,10 @@ sensor_probe(int devid, char *dxname, struct sensor *sensor)
log_warn("sensor_probe sysctl");
return (0);
}
+
+ if (sensordev.maxnumt[SENSOR_TIMEDELTA] == 0)
+ return (0);
+
strlcpy(dxname, sensordev.xname, MAXDEVNAMLEN);
slen = sizeof(*sensor);