summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstekloff <stekloff>2005-05-05 22:36:16 +0000
committerstekloff <stekloff>2005-05-05 22:36:16 +0000
commitaca8754c0abbdd9594bae86829cb5dea6d67a56a (patch)
treef06b51a9c35c8f78b5e22b33e00dd01994a0f22e
parent35b220146b08b1854af46ba1f2895e7914914a17 (diff)
downloadsysfsutils-aca8754c0abbdd9594bae86829cb5dea6d67a56a.tar.gz
Dominik's patch
-rw-r--r--CREDITS6
-rw-r--r--lib/sysfs_dir.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/CREDITS b/CREDITS
index 7fc4cba..4aaad5c 100644
--- a/CREDITS
+++ b/CREDITS
@@ -33,3 +33,9 @@ have made contributions:
- Supplied patch to fix sysfs_get_classdir_attr when
the directory vanishes from under us.
- Updates for building with udev and klibc.
+ o Dominik Brodowski <linux@dominikbrodowski.net>
+ - Fix feature in sysfs_write_attribute(), will now
+ write new value to attribute if attribute
+ is a show method and previously had nothing
+ to be read.
+
diff --git a/lib/sysfs_dir.c b/lib/sysfs_dir.c
index c2097c1..73031e1 100644
--- a/lib/sysfs_dir.c
+++ b/lib/sysfs_dir.c
@@ -222,7 +222,8 @@ int sysfs_write_attribute(struct sysfs_attribute *sysattr,
dprintf("Error reading attribute\n");
return -1;
}
- if ((strncmp(sysattr->value, new_value, sysattr->len)) == 0) {
+ if ((strncmp(sysattr->value, new_value, sysattr->len)) == 0 &&
+ (len == sysattr->len)) {
dprintf("Attr %s already has the requested value %s\n",
sysattr->name, new_value);
return 0;
@@ -480,7 +481,6 @@ struct dlist *get_attributes_list(struct dlist *alist, const char *path)
{
DIR *dir = NULL;
struct dirent *dirent = NULL;
- struct sysfs_attribute *attr = NULL;
char file_path[SYSFS_PATH_MAX];
if (!path) {