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

Gao Xiang hsiangkao at linux.alibaba.com
Fri Apr 10 00:45:49 AEST 2026


Hi Lucus,

On 2026/4/9 22:35, Lucas Karpinski wrote:
> 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;

Thanks for the suggestion, but it has been applied
to -dev branch, so I have to leave it as-is (I tend
to avoid rebasing -dev).

Thanks,
Gao Xiang

> 
> Regards,
> Lucas



More information about the Linux-erofs mailing list