The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/3012
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Suggested usage: return error_log_errno(err, "Failed: %s", "some error"); It sets errno to the value of err, then calls SYSERROR with the format and remaining args. Suggested-by: Signed-off-by: Christian Brauner <[email protected]> Signed-off-by: Thomas Parrott <[email protected]>
From 87e16f3c31f4dd3d1f7e61d0fab774ed6a8bc6cd Mon Sep 17 00:00:00 2001 From: Thomas Parrott <[email protected]> Date: Tue, 21 May 2019 17:25:52 +0100 Subject: [PATCH] lxc/log: Adds error_log_errno macro Suggested usage: return error_log_errno(err, "Failed: %s", "some error"); It sets errno to the value of err, then calls SYSERROR with the format and remaining args. Suggested-by: Signed-off-by: Christian Brauner <[email protected]> Signed-off-by: Thomas Parrott <[email protected]> --- src/lxc/log.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lxc/log.h b/src/lxc/log.h index 5afe4e0935..8b093de90b 100644 --- a/src/lxc/log.h +++ b/src/lxc/log.h @@ -505,6 +505,13 @@ ATTR_UNUSED static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \ } while (0) #endif +#define error_log_errno(__errno__, format, ...) \ + ({ \ + errno = __errno__; \ + SYSERROR(format, ##__VA_ARGS__); \ + -1; \ + }) + extern int lxc_log_fd; extern int lxc_log_syslog(int facility);
_______________________________________________ lxc-devel mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-devel
