]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libfrog: don't set negative errno in conversion functions
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 25 Jun 2019 21:04:42 +0000 (17:04 -0400)
committerEric Sandeen <sandeen@redhat.com>
Tue, 25 Jun 2019 21:04:42 +0000 (17:04 -0400)
Don't set errno to a negative value when we're converting integers.
That's a kernel thing; this is userspace.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libfrog/convert.c

index ed4cae7f4300da70306a81b2fba375fdb8936f9b..6239750757853ac90f836edee8460650eefde489 100644 (file)
@@ -47,7 +47,7 @@ cvt_s64(
                return i;
 
        /* Not all the input was consumed, return error. */
-       errno = -ERANGE;
+       errno = ERANGE;
        return INT64_MIN;
 }
 
@@ -68,7 +68,7 @@ cvt_s32(
        if (errno)
                return i;
        if (i > INT32_MAX || i < INT32_MIN) {
-               errno = -ERANGE;
+               errno = ERANGE;
                return INT32_MIN;
        }
        return i;
@@ -91,7 +91,7 @@ cvt_s16(
        if (errno)
                return i;
        if (i > INT16_MAX || i < INT16_MIN) {
-               errno = -ERANGE;
+               errno = ERANGE;
                return INT16_MIN;
        }
        return i;
@@ -123,7 +123,7 @@ cvt_u64(
                return i;
 
        /* Not all the input was consumed, return error. */
-       errno = -ERANGE;
+       errno = ERANGE;
        return UINT64_MAX;
 }
 
@@ -144,7 +144,7 @@ cvt_u32(
        if (errno)
                return i;
        if (i > UINT32_MAX) {
-               errno = -ERANGE;
+               errno = ERANGE;
                return UINT32_MAX;
        }
        return i;
@@ -167,7 +167,7 @@ cvt_u16(
        if (errno)
                return i;
        if (i > UINT16_MAX) {
-               errno = -ERANGE;
+               errno = ERANGE;
                return UINT16_MAX;
        }
        return i;