log: add CMD_SYSERROR()

Add a thread-safe and uniform way to retrieve errno values in programs that are shipped as part of LXC but are not expected to have access to the logging system. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent ee75dca2
......@@ -429,6 +429,12 @@ ATTR_UNUSED static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \
ERROR("%s - " format, ptr, ##__VA_ARGS__); \
} while (0)
#define CMD_SYSERROR(format, ...) \
do { \
lxc_log_strerror_r; \
fprintf(stderr, "%s - " format, ptr, ##__VA_ARGS__); \
} while (0)
extern int lxc_log_fd;
extern int lxc_log_syslog(int facility);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment