forked from extern/endlessh
Save errno value across logmsg()
Need to be able to log messages without affecting errno.
This commit is contained in:
parent
47b901d9d3
commit
f2128b58f2
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user