summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2007-11-09 18:40:20 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2007-11-09 18:40:20 +0000
commit32d545cc1c0c5bef8a9b280f7d5a9e3ce45b9998 (patch)
tree8680f41e99a3d0e729bac72a6e132eeaa9edac12 /lib
parent80ff0d9e2b8a794bb9275f24e0588d3d0b71f314 (diff)
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')
-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