summaryrefslogtreecommitdiff
path: root/usr.sbin/sensorsd/sensorsd.c
diff options
context:
space:
mode:
authorConstantine A. Murenin <cnst@cvs.openbsd.org>2007-05-29 02:02:13 +0000
committerConstantine A. Murenin <cnst@cvs.openbsd.org>2007-05-29 02:02:13 +0000
commit58a580912f38a3e223832989130353a28c1b06cb (patch)
treeea8d4514eeee41f9a6b5a8a498ddfd74f0578979 /usr.sbin/sensorsd/sensorsd.c
parentba34ded03b462b7ce440edfef79fdec941252b5b (diff)
for sensorsd.conf entries, let's do matching by sensor type if maching by complete sysctl name does not yield anything; ok henning, otto
Diffstat (limited to 'usr.sbin/sensorsd/sensorsd.c')
-rw-r--r--usr.sbin/sensorsd/sensorsd.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/usr.sbin/sensorsd/sensorsd.c b/usr.sbin/sensorsd/sensorsd.c
index 32bef5b8951..084c086a85b 100644
--- a/usr.sbin/sensorsd/sensorsd.c
+++ b/usr.sbin/sensorsd/sensorsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sensorsd.c,v 1.29 2007/02/28 15:28:22 henning Exp $ */
+/* $OpenBSD: sensorsd.c,v 1.30 2007/05/29 02:02:12 cnst Exp $ */
/*
* Copyright (c) 2003 Henning Brauer <henning@openbsd.org>
@@ -414,23 +414,24 @@ parse_config(char *cf)
snprintf(node, sizeof(node), "hw.sensors.%s.%s%d",
p->dxname, sensor_type_s[p->type], p->numt);
if (cgetent(&buf, cfa, node) != 0)
- p->watch = 0;
- else {
- p->watch = 1;
- watch_cnt++;
- if (cgetstr(buf, "low", &ebuf) < 0)
- ebuf = NULL;
- p->lower = get_val(ebuf, 0, p->type);
- if (cgetstr(buf, "high", &ebuf) < 0)
- ebuf = NULL;
- p->upper = get_val(ebuf, 1, p->type);
- if (cgetstr(buf, "command", &ebuf) < 0)
- ebuf = NULL;
- if (ebuf)
- asprintf(&(p->command), "%s", ebuf);
- free(buf);
- buf = NULL;
- }
+ if (cgetent(&buf, cfa, sensor_type_s[p->type]) != 0) {
+ p->watch = 0;
+ continue;
+ }
+ p->watch = 1;
+ watch_cnt++;
+ if (cgetstr(buf, "low", &ebuf) < 0)
+ ebuf = NULL;
+ p->lower = get_val(ebuf, 0, p->type);
+ if (cgetstr(buf, "high", &ebuf) < 0)
+ ebuf = NULL;
+ p->upper = get_val(ebuf, 1, p->type);
+ if (cgetstr(buf, "command", &ebuf) < 0)
+ ebuf = NULL;
+ if (ebuf)
+ asprintf(&(p->command), "%s", ebuf);
+ free(buf);
+ buf = NULL;
}
free(cfa);
return (watch_cnt);