mirror of
git://github.com/lxc/lxc
synced 2025-08-31 14:54:09 +00:00
log: fix cross-compilation with %m modifier
Fixes: #3961 Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
26
configure.ac
26
configure.ac
@@ -711,32 +711,6 @@ AC_CHECK_MEMBERS([struct clone_args.cgroup],[],[],[[#include <linux/sched.h>]])
|
||||
# - STRERROR_R_CHAR_P if it returns char *
|
||||
AC_FUNC_STRERROR_R
|
||||
|
||||
# Check if "%m" is supported by printf and Co
|
||||
AC_MSG_CHECKING([%m format])
|
||||
AC_RUN_IFELSE([AC_LANG_SOURCE([[
|
||||
#include <stdio.h>
|
||||
int main(void)
|
||||
{
|
||||
char msg[256];
|
||||
int rc;
|
||||
|
||||
rc = snprintf(msg, sizeof(msg), "%m\n");
|
||||
if ((rc > 1) && (msg[0] != '%'))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}]])],[fmt_m=yes],[fmt_m=no],[fmt_m=no])
|
||||
if test "x$fmt_m" = "xyes"; then
|
||||
AC_DEFINE([HAVE_M_FORMAT], 1, [Have %m format])
|
||||
AC_MSG_RESULT([yes])
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
# Check for some functions
|
||||
AC_CHECK_LIB(pthread, main)
|
||||
AC_CHECK_LIB(util, openpty)
|
||||
|
@@ -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 HAVE_M_FORMAT && !ENABLE_COVERITY_BUILD
|
||||
#if defined(__GNU_LIBRARY__) && !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 HAVE_M_FORMAT && !ENABLE_COVERITY_BUILD
|
||||
#if defined(__GNU_LIBRARY__) && !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 HAVE_M_FORMAT && !ENABLE_COVERITY_BUILD
|
||||
#if defined(__GNU_LIBRARY__) && !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 HAVE_M_FORMAT && !ENABLE_COVERITY_BUILD
|
||||
#if defined(__GNU_LIBRARY__) && !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 HAVE_M_FORMAT && !ENABLE_COVERITY_BUILD
|
||||
#if defined(__GNU_LIBRARY__) && !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 HAVE_M_FORMAT && !ENABLE_COVERITY_BUILD
|
||||
#if defined(__GNU_LIBRARY__) && !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 HAVE_M_FORMAT && !ENABLE_COVERITY_BUILD
|
||||
#if defined(__GNU_LIBRARY__) && !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 HAVE_M_FORMAT && !ENABLE_COVERITY_BUILD
|
||||
#if defined(__GNU_LIBRARY__) && !ENABLE_COVERITY_BUILD
|
||||
#define CMD_SYSINFO(format, ...) \
|
||||
printf("%s: %d: %s - %m - " format "\n", __FILE__, __LINE__, __func__, \
|
||||
##__VA_ARGS__);
|
||||
|
Reference in New Issue
Block a user