]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
log: ensure we always return negative errno 3771/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 6 Apr 2021 08:34:31 +0000 (10:34 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 6 Apr 2021 08:34:31 +0000 (10:34 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/log.h

index 27690bba317101e0555c0db4233f933821bd1193..e90dadef7dbd23f12c97167e41c32291fc27fcc2 100644 (file)
@@ -565,7 +565,7 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo,        \
 #define syserror(format, ...)                    \
        ({                                       \
                SYSERROR(format, ##__VA_ARGS__); \
-               (-errno);                        \
+               (-labs(errno));                  \
        })
 
 #define syserror_set(__ret__, format, ...)                    \
@@ -586,7 +586,7 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo,        \
 #define syswarn(format, ...)                    \
        ({                                      \
                SYSWARN(format, ##__VA_ARGS__); \
-               (-errno);                       \
+               (-labs(errno));                 \
        })
 
 #define syswarn_set(__ret__, format, ...)                     \
@@ -605,16 +605,16 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo,      \
        })
 
 #define sysinfo(format, ...)                    \
-       ({                                       \
+       ({                                      \
                SYSINFO(format, ##__VA_ARGS__); \
-               (-errno);                        \
+               (-labs(errno));                 \
        })
 
-#define sysinfo_set(__ret__, format, ...)                    \
+#define sysinfo_set(__ret__, format, ...)                     \
        ({                                                    \
                typeof(__ret__) __internal_ret__ = (__ret__); \
                errno = labs(__ret__);                        \
-               SYSINFO(format, ##__VA_ARGS__);              \
+               SYSINFO(format, ##__VA_ARGS__);               \
                __internal_ret__;                             \
        })
 
@@ -628,7 +628,7 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo,        \
 #define sysdebug(format, ...)                    \
        ({                                       \
                SYSDEBUG(format, ##__VA_ARGS__); \
-               (-errno);                        \
+               (-labs(errno));                  \
        })
 
 #define sysdebug_set(__ret__, format, ...)                    \
@@ -649,7 +649,7 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo,        \
 #define systrace(format, ...)                    \
        ({                                       \
                SYSTRACE(format, ##__VA_ARGS__); \
-               (-errno);                        \
+               (-labs(errno));                  \
        })
 
 #define systrace_set(__ret__, format, ...)                    \