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

Gao Xiang <[email protected]>
Newsgroups org.ozlabs.lists.linux-erofs
Message-ID <[email protected]>
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 <[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;
>>   }
>>   
> 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
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.