Save errno value across logmsg()

Need to be able to log messages without affecting errno.
This commit is contained in:
Christopher Wellons 2019-02-05 23:26:46 -05:00
parent 47b901d9d3
commit f2128b58f2

View File

@ -42,6 +42,8 @@ static void
logmsg(enum loglevel level, const char *format, ...)
{
if (loglevel >= level) {
int save = errno;
/* Print a timestamp */
long long now = uepoch();
time_t t = now / 1000;
@ -56,6 +58,8 @@ logmsg(enum loglevel level, const char *format, ...)
vprintf(format, ap);
va_end(ap);
fputc('\n', stdout);
errno = save;
}
}