diff options
author | Reyk Floeter <reyk@cvs.openbsd.org> | 2016-11-24 21:39:46 +0000 |
---|---|---|
committer | Reyk Floeter <reyk@cvs.openbsd.org> | 2016-11-24 21:39:46 +0000 |
commit | 39b0c25012d1aea950a4ffb19979b247a8564ea2 (patch) | |
tree | d3e28aa537736f9bd3b3d02c2d1e70d20b658f3a | |
parent | 0c2dcd3e2ab27e78b2935b459a12b2471a3b3bb6 (diff) |
Restore the errno in vlog() as well to have the same "safe errno"
effect in log_debug(), log_warn*() and all the other logging
functions.
-rw-r--r-- | usr.sbin/vmd/log.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/vmd/log.c b/usr.sbin/vmd/log.c index 713d3d3f0c3..c8621240213 100644 --- a/usr.sbin/vmd/log.c +++ b/usr.sbin/vmd/log.c @@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.5 2016/11/22 21:54:01 reyk Exp $ */ +/* $OpenBSD: log.c,v 1.6 2016/11/24 21:39:45 reyk Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -90,6 +90,7 @@ void vlog(int pri, const char *fmt, va_list ap) { char *nfmt; + int saved_errno = errno; if (debug) { /* best effort in out of mem situations */ @@ -103,8 +104,9 @@ vlog(int pri, const char *fmt, va_list ap) fflush(stderr); } else vsyslog(pri, fmt, ap); -} + errno = saved_errno; +} void log_warn(const char *emsg, ...) |