mirror of
git://github.com/lxc/lxc
synced 2025-08-31 02:29:34 +00:00
log: save errno on strerror_r()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
@@ -344,7 +344,9 @@ ATTR_UNUSED static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \
|
||||
char errno_buf[MAXPATHLEN / 2] = {"Failed to get errno string"}; \
|
||||
char *ptr = NULL; \
|
||||
{ \
|
||||
int saved_errno = errno; \
|
||||
ptr = strerror_r(errno, errno_buf, sizeof(errno_buf)); \
|
||||
errno = saved_errno; \
|
||||
if (!ptr) \
|
||||
ptr = errno_buf; \
|
||||
}
|
||||
@@ -353,7 +355,9 @@ ATTR_UNUSED static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \
|
||||
char errno_buf[MAXPATHLEN / 2] = {"Failed to get errno string"}; \
|
||||
char *ptr = errno_buf; \
|
||||
{ \
|
||||
int saved_errno = errno; \
|
||||
(void)strerror_r(errno, errno_buf, sizeof(errno_buf)); \
|
||||
errno = saved_errno; \
|
||||
}
|
||||
#endif
|
||||
#elif ENFORCE_THREAD_SAFETY
|
||||
|
Reference in New Issue
Block a user