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>
return i;
/* Not all the input was consumed, return error. */
- errno = -ERANGE;
+ errno = ERANGE;
return INT64_MIN;
}
if (errno)
return i;
if (i > INT32_MAX || i < INT32_MIN) {
- errno = -ERANGE;
+ errno = ERANGE;
return INT32_MIN;
}
return i;
if (errno)
return i;
if (i > INT16_MAX || i < INT16_MIN) {
- errno = -ERANGE;
+ errno = ERANGE;
return INT16_MIN;
}
return i;
return i;
/* Not all the input was consumed, return error. */
- errno = -ERANGE;
+ errno = ERANGE;
return UINT64_MAX;
}
if (errno)
return i;
if (i > UINT32_MAX) {
- errno = -ERANGE;
+ errno = ERANGE;
return UINT32_MAX;
}
return i;
if (errno)
return i;
if (i > UINT16_MAX) {
- errno = -ERANGE;
+ errno = ERANGE;
return UINT16_MAX;
}
return i;