[PATCH] erofs-utils: fix erofs_sys_lsetxattr() returning positive errno
Lucas Karpinski
lkarpinski at nvidia.com
Fri Apr 10 00:35:31 AEST 2026
On 2026-04-07 5:21 a.m., Zhan Xusheng wrote:
> 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;
> }
>
For consistency with erofs_sys_lgetxattr():
- return errno;
+ ret = -errno;
Regards,
Lucas
More information about the Linux-erofs
mailing list