libfs: return error code on failed attr set
PATCH 21/21 libfs: return error code on failed attr set
From: Wu Fengguang <[email protected]>
Currently all simple_attr.set handlers return 0 on success and negative codes on error. Fix simple_attr_write() to return these error codes.
Signed-off-by Wu Fengguang <[email protected]>
Cc Theodore Ts'o <[email protected]>
Cc Al Viro <[email protected]>
Cc Christoph Hellwig <[email protected]>
Cc Nick Piggin <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
fs/libfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/libfs.c renamed from fs/libfs.c~libfs-return-error-code-on-failed-attr-set +3 -2
@@ -739,10 +739,11 @@ ssize_t simple_attr_write(struct file *fif (copy_from_user (attr->set_buf, buf, size)) goto out; - ret = len;/* claim we got the whole input */ attr->set_buf[size] ='\0' ; val =simple_strtol (attr->set_buf,NULL ,0 ); - attr->set (attr->data, val); + ret = attr->set (attr->data, val); +if (ret ==0 ) + ret = len;/* on success, claim we got the whole input */ out:mutex_unlock (&attr->mutex);return ret;
_