utils: fix ppc64le builds

I suspect that there's a glibc bug on ppc64le. Both clang and gcc a very
unhappy when you return -errno from these functions. Instead, let's return
concrete errno numbers, e.g. -EINVAL.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2017-05-18 13:18:29 +02:00
parent 1de3c9170e
commit ff0e49c768
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View File

@ -2008,7 +2008,7 @@ int lxc_safe_uint(const char *numstr, unsigned int *converted)
errno = 0;
uli = strtoul(numstr, &err, 0);
if (errno == ERANGE && uli == ULONG_MAX)
return -errno;
return -ERANGE;
if (err == numstr || *err != '\0')
return -EINVAL;
@ -2028,10 +2028,10 @@ int lxc_safe_int(const char *numstr, int *converted)
errno = 0;
sli = strtol(numstr, &err, 0);
if (errno == ERANGE && (sli == LONG_MAX || sli == LONG_MIN))
return -errno;
return -ERANGE;
if (errno != 0 && sli == 0)
return -errno;
return -EINVAL;
if (err == numstr || *err != '\0')
return -EINVAL;
@ -2051,10 +2051,10 @@ int lxc_safe_long(const char *numstr, long int *converted)
errno = 0;
sli = strtol(numstr, &err, 0);
if (errno == ERANGE && (sli == LONG_MAX || sli == LONG_MIN))
return -errno;
return -ERANGE;
if (errno != 0 && sli == 0)
return -errno;
return -EINVAL;
if (err == numstr || *err != '\0')
return -EINVAL;