summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/syslog.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2007-11-09 18:40:19 +0000
committermillert <millert@openbsd.org>2007-11-09 18:40:19 +0000
commit3f11cdeb2c90df87e7b038adcc1099c6601f4245 (patch)
treea5b877f5abe5d3be91425c2912e96b445a03f4ab /lib/libc/gen/syslog.c
parentBuild and advertize bsd.mp on mvme88k. (diff)
downloadwireguard-openbsd-3f11cdeb2c90df87e7b038adcc1099c6601f4245.tar.xz
wireguard-openbsd-3f11cdeb2c90df87e7b038adcc1099c6601f4245.zip
Stash value of log_tag before calling closelog_r() and restore it after.
When closelog() was modified to clear log_tag it inadvertantly made syslog_r() (which calls closelog_r at the end) clear log_tag as well. OK miod@ dhartmei@
Diffstat (limited to 'lib/libc/gen/syslog.c')
-rw-r--r--lib/libc/gen/syslog.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libc/gen/syslog.c b/lib/libc/gen/syslog.c
index 6bba3930e91..87f838decb0 100644
--- a/lib/libc/gen/syslog.c
+++ b/lib/libc/gen/syslog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: syslog.c,v 1.28 2005/08/08 08:05:34 espie Exp $ */
+/* $OpenBSD: syslog.c,v 1.29 2007/11/09 18:40:19 millert Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -279,8 +279,12 @@ vsyslog_r(int pri, struct syslog_data *data, const char *fmt, va_list ap)
(void)close(fd);
}
- if (data != &sdata)
+ if (data != &sdata) {
+ /* preserve log_tag from being cleared by closelog_r() */
+ const char *ident = data->log_tag;
closelog_r(data);
+ data->log_tag = ident;
+ }
}
static void