From: Christian Brauner Date: Thu, 18 May 2017 11:18:29 +0000 (+0200) Subject: utils: fix ppc64le builds X-Git-Tag: lxc-2.1.0~119^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1573%2Fhead;p=thirdparty%2Flxc.git 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 --- diff --git a/src/lxc/utils.c b/src/lxc/utils.c index 15c9f91b5..ac14793d0 100644 --- a/src/lxc/utils.c +++ b/src/lxc/utils.c @@ -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;