[PATCH] erofs-utils: fix erofs_sys_lsetxattr() returning positive errno

Zhan Xusheng <[email protected]>
Newsgroups org.ozlabs.lists.linux-erofs
Message-ID <[email protected]>
erofs_sys_lsetxattr() returns bare `errno` (a positive value) on
failure, unlike its sibling erofs_sys_lgetxattr() which correctly
returns `-errno`.

Fix by returning -errno, consistent with erofs_sys_lgetxattr().

Fixes: e0d85fc5a282 ("erofs-utils: lib: introduce erofs_sys_lsetxattr()")
Signed-off-by: Zhan Xusheng <[email protected]>
---
 lib/xattr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/xattr.c b/lib/xattr.c
index 565070a..af1b9ca 100644
--- a/lib/xattr.c
+++ b/lib/xattr.c
@@ -123,7 +123,7 @@ ssize_t erofs_sys_lsetxattr(const char *path, const char *name,
 	errno = ENODATA;
 #endif
 	if (ret < 0)
-		return errno;
+		return -errno;
 	return ret;
 }
 
-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.