- Return the value returned by prop_dictionary_{recv,send}_ioctl
in all cases. - Skip sensors that do not have a description object in its dictionary.
This commit is contained in:
parent
92f4397e50
commit
8b1500977e
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: envstat.c,v 1.36 2007/07/17 15:43:08 xtraeme Exp $ */
|
/* $NetBSD: envstat.c,v 1.37 2007/07/17 17:40:59 xtraeme Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
* Copyright (c) 2007 The NetBSD Foundation, Inc.
|
||||||
|
@ -241,8 +241,9 @@ send_dictionary(int fd)
|
||||||
* know what type of sensor are we trying to set
|
* know what type of sensor are we trying to set
|
||||||
* a critical condition.
|
* a critical condition.
|
||||||
*/
|
*/
|
||||||
if (prop_dictionary_recv_ioctl(fd, ENVSYS_GETDICTIONARY, &dict))
|
error = prop_dictionary_recv_ioctl(fd, ENVSYS_GETDICTIONARY, &dict);
|
||||||
return EINVAL;
|
if (error)
|
||||||
|
return error;
|
||||||
|
|
||||||
if (mydevname) {
|
if (mydevname) {
|
||||||
obj = prop_dictionary_get(dict, mydevname);
|
obj = prop_dictionary_get(dict, mydevname);
|
||||||
|
@ -505,8 +506,9 @@ parse_dictionary(int fd)
|
||||||
int rval = 0;
|
int rval = 0;
|
||||||
|
|
||||||
/* receive dictionary from kernel */
|
/* receive dictionary from kernel */
|
||||||
if (prop_dictionary_recv_ioctl(fd, ENVSYS_GETDICTIONARY, &dict))
|
rval = prop_dictionary_recv_ioctl(fd, ENVSYS_GETDICTIONARY, &dict);
|
||||||
return EINVAL;
|
if (rval)
|
||||||
|
return rval;
|
||||||
|
|
||||||
if (mydevname) {
|
if (mydevname) {
|
||||||
obj = prop_dictionary_get(dict, mydevname);
|
obj = prop_dictionary_get(dict, mydevname);
|
||||||
|
@ -613,10 +615,13 @@ find_sensors(prop_array_t array)
|
||||||
|
|
||||||
/* description string */
|
/* description string */
|
||||||
desc = prop_dictionary_get(obj, "description");
|
desc = prop_dictionary_get(obj, "description");
|
||||||
/* copy description */
|
if (desc != NULL) {
|
||||||
(void)strlcpy(gesen[gnelems].desc,
|
/* copy description */
|
||||||
prop_string_cstring_nocopy(desc),
|
(void)strlcpy(gesen[gnelems].desc,
|
||||||
sizeof(gesen[gnelems].desc));
|
prop_string_cstring_nocopy(desc),
|
||||||
|
sizeof(gesen[gnelems].desc));
|
||||||
|
} else
|
||||||
|
continue;
|
||||||
|
|
||||||
/* type string */
|
/* type string */
|
||||||
obj1 = prop_dictionary_get(obj, "type");
|
obj1 = prop_dictionary_get(obj, "type");
|
||||||
|
|
Loading…
Reference in New Issue