]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
utils: fix ppc64le builds 1573/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 18 May 2017 11:18:29 +0000 (13:18 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 18 May 2017 11:18:29 +0000 (13:18 +0200)
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>
src/lxc/utils.c

index 15c9f91b584af135e63f9f65a928c90b68ff8762..ac14793d00c14873abc22de317f0f66a5cdd7754 100644 (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;