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

Erik Sjölund erik.sjolund at gmail.com
Tue Oct 3 04:36:08 AEDT 2023


Hi,
Does this patch make sense?
(I thought errno should be set to a non-negative value)
Best regards,
Erik Sjölund

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