From: Christian Brauner Date: Mon, 3 Sep 2018 10:17:46 +0000 (+0200) Subject: log: do not clobber errno X-Git-Tag: lxc-3.1.0~118^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7051eb7e6072e15a9e47e1a889bbc1d9f2f166c;p=thirdparty%2Flxc.git log: do not clobber errno Signed-off-by: Christian Brauner --- diff --git a/src/lxc/log.h b/src/lxc/log.h index a7f72b4c7..43199bea5 100644 --- a/src/lxc/log.h +++ b/src/lxc/log.h @@ -276,6 +276,7 @@ ATTR_UNUSED static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \ { \ if (lxc_log_priority_is_enabled(acategory, LXC_LOG_LEVEL_##LEVEL)) { \ va_list va_ref; \ + int saved_errno; \ struct lxc_log_event evt = { \ .category = (acategory)->name, \ .priority = LXC_LOG_LEVEL_##LEVEL, \ @@ -287,12 +288,14 @@ ATTR_UNUSED static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \ * without restrictions. So let's use it for our \ * logging stamps. \ */ \ + saved_errno = errno; \ (void)clock_gettime(CLOCK_REALTIME, &evt.timestamp); \ \ va_start(va_ref, format); \ evt.vap = &va_ref; \ __lxc_log(acategory, &evt); \ va_end(va_ref); \ + errno = saved_errno; \ } \ }