[lxc-devel] [lxc/master] utils: fix ppc64le builds
brauner on Github
lxc-bot at linuxcontainers.org
Thu May 18 11:20:17 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 555 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170518/96ba7499/attachment.bin>
-------------- next part --------------
From ff0e49c768ae23b3c700ec66ea42023c94dd1ca8 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 18 May 2017 13:18:29 +0200
Subject: [PATCH] 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 at ubuntu.com>
---
src/lxc/utils.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/lxc/utils.c b/src/lxc/utils.c
index 15c9f91..ac14793 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;
More information about the lxc-devel
mailing list