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

Gao Xiang xiang at kernel.org
Fri Oct 6 05:43:29 AEDT 2023


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.

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