With badly configured logging and higher logging levels, the code can
see wrong errno from syscalls. So always retore original errno when logging.
char buf[1024];
char tbuf[64];
int len;
+ int old_errno = errno;
render_time(tbuf, sizeof(tbuf));
len = snprintf(buf, sizeof(buf), "%s %u %s %s\n",
if (!cf_quiet)
fprintf(stderr, "%s", buf);
+
+ if (old_errno != errno)
+ errno = old_errno;
}
static void _log(const char *pfx, const char *fmt, va_list ap)