errno is set to a negative value in lib/tar.c

Gao Xiang hsiangkao at linux.alibaba.com
Sun Oct 8 11:09:52 AEDT 2023



On 2023/10/6 02:43, Gao Xiang wrote:
> Hi Erik,
> 
> On Mon, Oct 02, 2023 at 07:36:08PM +0200, Erik Sjölund wrote:
>> Hi,
>> Does this patch make sense?
>> (I thought errno should be set to a non-negative value)
>> Best regards,
>> Erik Sjölund
> 
> Thanks for the patch.
> 
> I'm on vacation, sorry for late reply.  It looks good to me,
> I will address it when I'm back.

Since this is a one-line patch, I've applied this to -dev
directly.  But in principle we need a proper Signed-off-by
tag at least..

Thanks,
Gao Xiang

> 
> Thanks,
> Gao Xiang
> 
>>
>> diff --git a/lib/tar.c b/lib/tar.c
>> index 0744972..8204939 100644
>> --- a/lib/tar.c
>> +++ b/lib/tar.c
>> @@ -241,7 +241,7 @@ static long long tarerofs_otoi(const char *ptr, int len)
>>          val = strtol(ptr, &endp, 8);
>>          if ((!val && endp == inp) |
>>               (*endp && *endp != ' '))
>> -               errno = -EINVAL;
>> +               errno = EINVAL;
>>          return val;
>>   }


More information about the Linux-erofs mailing list