_saved_errno_ = -1; \
} while (false)
+#define LOCAL_ERRNO(value) \
+ PROTECT_ERRNO; \
+ errno = abs(value)
+
static inline int negative_errno(void) {
/* This helper should be used to shut up gcc if you know 'errno' is
* negative. Instead of "return -errno;", use "return negative_errno();"
const char *format,
va_list ap) {
- char buffer[LINE_MAX];
- PROTECT_ERRNO;
-
if (_likely_(LOG_PRI(level) > log_max_level))
return -ERRNO_VALUE(error);
/* Make sure that %m maps to the specified error (or "Success"). */
- errno = ERRNO_VALUE(error);
+ char buffer[LINE_MAX];
+ LOCAL_ERRNO(ERRNO_VALUE(error));
(void) vsnprintf(buffer, sizeof buffer, format, ap);
const char *format,
va_list ap) {
- PROTECT_ERRNO;
char *buffer, *b;
if (_likely_(LOG_PRI(level) > log_max_level))
return -ERRNO_VALUE(error);
/* Make sure that %m maps to the specified error (or "Success"). */
- errno = ERRNO_VALUE(error);
+ LOCAL_ERRNO(ERRNO_VALUE(error));
/* Prepend the object name before the message */
if (object) {