]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
macro: ensure ret_errno() always returns negative
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 6 Apr 2021 15:10:49 +0000 (17:10 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 7 Apr 2021 07:38:27 +0000 (09:38 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/macro.h

index 4c13f8335933596ddb15336d6aeaa94671fc21c0..42f95c23541ef38d7778636e8d2852a260d6bfa2 100644 (file)
@@ -663,10 +663,10 @@ enum {
                __internal_ret__;                             \
        })
 
-#define ret_errno(__errno__)         \
-       ({                           \
-               errno = (__errno__); \
-               -(__errno__);        \
+#define ret_errno(__errno__)             \
+       ({                               \
+               errno = labs(__errno__); \
+               -errno;                  \
        })
 
 /* Container's specific file/directory names */