]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
log: improve %m handling on musl 3988/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Mon, 4 Oct 2021 09:23:55 +0000 (11:23 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 4 Oct 2021 09:24:19 +0000 (11:24 +0200)
Fixes: #3961
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/log.h

index 2a6da40e95f8ef6b5d684e890d734a9146be0555..6cee31886c487c2526ec4ada6c875a5670ca9716 100644 (file)
@@ -391,7 +391,7 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo,        \
        LXC_FATAL(&locinfo, format, ##__VA_ARGS__);                     \
 } while (0)
 
-#if defined(__GNU_LIBRARY__) && !ENABLE_COVERITY_BUILD
+#if (defined(__GNU_LIBRARY__) || defined(__MUSL__))  && !ENABLE_COVERITY_BUILD
 #define SYSTRACE(format, ...)                              \
                TRACE("%m - " format, ##__VA_ARGS__)
 #else
@@ -402,7 +402,7 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo,        \
        } while (0)
 #endif
 
-#if defined(__GNU_LIBRARY__) && !ENABLE_COVERITY_BUILD
+#if (defined(__GNU_LIBRARY__) || defined(__MUSL__))  && !ENABLE_COVERITY_BUILD
 #define SYSDEBUG(format, ...)                              \
                 DEBUG("%m - " format, ##__VA_ARGS__)
 #else
@@ -414,7 +414,7 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo,        \
 #endif
 
 
-#if defined(__GNU_LIBRARY__) && !ENABLE_COVERITY_BUILD
+#if (defined(__GNU_LIBRARY__) || defined(__MUSL__))  && !ENABLE_COVERITY_BUILD
 #define SYSINFO(format, ...)                              \
                 INFO("%m - " format, ##__VA_ARGS__)
 #else
@@ -425,7 +425,7 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo,        \
        } while (0)
 #endif
 
-#if defined(__GNU_LIBRARY__) && !ENABLE_COVERITY_BUILD
+#if (defined(__GNU_LIBRARY__) || defined(__MUSL__))  && !ENABLE_COVERITY_BUILD
 #define SYSNOTICE(format, ...)                              \
                NOTICE("%m - " format, ##__VA_ARGS__)
 #else
@@ -436,7 +436,7 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo,        \
        } while (0)
 #endif
 
-#if defined(__GNU_LIBRARY__) && !ENABLE_COVERITY_BUILD
+#if (defined(__GNU_LIBRARY__) || defined(__MUSL__))  && !ENABLE_COVERITY_BUILD
 #define SYSWARN(format, ...)                              \
                WARN("%m - " format, ##__VA_ARGS__)
 #else
@@ -447,7 +447,7 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo,        \
        } while (0)
 #endif
 
-#if defined(__GNU_LIBRARY__) && !ENABLE_COVERITY_BUILD
+#if (defined(__GNU_LIBRARY__) || defined(__MUSL__))  && !ENABLE_COVERITY_BUILD
 #define SYSERROR(format, ...)                              \
                ERROR("%m - " format, ##__VA_ARGS__)
 #else
@@ -458,7 +458,7 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo,        \
        } while (0)
 #endif
 
-#if defined(__GNU_LIBRARY__) && !ENABLE_COVERITY_BUILD
+#if (defined(__GNU_LIBRARY__) || defined(__MUSL__))  && !ENABLE_COVERITY_BUILD
 #define CMD_SYSERROR(format, ...)                                             \
        fprintf(stderr, "%s: %d: %s - %m - " format "\n", __FILE__, __LINE__, \
                __func__, ##__VA_ARGS__);
@@ -471,7 +471,7 @@ __lxc_unused static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo,        \
        } while (0)
 #endif
 
-#if defined(__GNU_LIBRARY__) && !ENABLE_COVERITY_BUILD
+#if (defined(__GNU_LIBRARY__) || defined(__MUSL__))  && !ENABLE_COVERITY_BUILD
 #define CMD_SYSINFO(format, ...)                                               \
        printf("%s: %d: %s - %m - " format "\n", __FILE__, __LINE__, __func__, \
               ##__VA_ARGS__);