14 Apr 2004 17:34
[PATCH] sysfsutils write only attributes bug
Brian King <brking <at> us.ibm.com>
2004-04-14 15:34:18 GMT
2004-04-14 15:34:18 GMT
I ran into a bug in sysfsutils, where sysfs_get_directory_attribute is calling
sysfs_read_attribute, which fails for attributes that are write-only. The attached
patch fixes this.
---
diff -puN lib/sysfs_dir.c~read_only_attr lib/sysfs_dir.c
--- sysfsutils-1.0.0/lib/sysfs_dir.c~read_only_attr 2004-04-12 05:29:51.649953816 -0700
+++ sysfsutils-1.0.0-root/lib/sysfs_dir.c 2004-04-12 05:31:22.857933296 -0700
<at> <at> -889,7 +889,8 <at> <at> struct sysfs_attribute *sysfs_get_direct
attr = (struct sysfs_attribute *)dlist_find_custom
(dir->attributes, attrname, dir_attribute_name_equal);
if (attr != NULL) {
- if ((sysfs_read_attribute(attr)) != 0) {
+ if ((attr->method & SYSFS_METHOD_SHOW) &&
+ (sysfs_read_attribute(attr)) != 0) {
dprintf("Error reading attribute %s\n", attr->name);
return NULL;
}
_
--
--
Brian King
eServer Storage I/O
IBM Linux Technology Center
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
(Continue reading)
RSS Feed