[PATCH] erofs-utils: fix erofs_sys_lsetxattr() returning positive errno
Zhan Xusheng
zhanxusheng1024 at gmail.com
Tue Apr 7 19:21:41 AEST 2026
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 <zhanxusheng at xiaomi.com>
---
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
More information about the Linux-erofs
mailing list