Brian King | 14 Apr 2004 17:34
Picon
Favicon

[PATCH] sysfsutils write only attributes bug

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)

Ananth N Mavinakayanahalli | 15 Apr 2004 16:02
Picon

Re: [PATCH] sysfsutils write only attributes bug

On Wed, Apr 14, 2004 at 10:34:18AM -0500, Brian King wrote:
> 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.

Oh! Missed that one.. Patch applied, thanks!

--

-- 
Ananth Narayan
Linux Technology Center,
IBM Software Lab, INDIA

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

Gmane