diff options
-rw-r--r-- | lib/libc/gen/syslog_r.c | 21 | ||||
-rw-r--r-- | lib/libc/hidden/syslog.h | 5 | ||||
-rw-r--r-- | lib/libc/sys/Makefile.inc | 5 |
3 files changed, 9 insertions, 22 deletions
diff --git a/lib/libc/gen/syslog_r.c b/lib/libc/gen/syslog_r.c index d5ae4aa88c1..73e237376ad 100644 --- a/lib/libc/gen/syslog_r.c +++ b/lib/libc/gen/syslog_r.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syslog_r.c,v 1.10 2015/10/31 02:57:16 deraadt Exp $ */ +/* $OpenBSD: syslog_r.c,v 1.11 2015/11/25 00:01:21 deraadt Exp $ */ /* * Copyright (c) 1983, 1988, 1993 * The Regents of the University of California. All rights reserved. @@ -195,24 +195,7 @@ __vsyslog_r(int pri, struct syslog_data *data, * If the sendsyslog() fails, it means that syslogd * is not running. */ - error = sendsyslog(tbuf, cnt); - - /* - * Output the message to the console; try not to block - * as a blocking console should not stop other processes. - * Make sure the error reported is the one from the syslogd failure. - */ - if (error == -1 && (data->log_stat & LOG_CONS) && - (fd = open(_PATH_CONSOLE, O_WRONLY|O_NONBLOCK, 0)) >= 0) { - struct iovec iov[2]; - - iov[0].iov_base = conp; - iov[0].iov_len = cnt > conp - tbuf ? cnt - (conp - tbuf) : 0; - iov[1].iov_base = "\r\n"; - iov[1].iov_len = 2; - (void)writev(fd, iov, 2); - (void)close(fd); - } + error = sendsyslog2(tbuf, cnt, data->log_stat & LOG_CONS); } void diff --git a/lib/libc/hidden/syslog.h b/lib/libc/hidden/syslog.h index 1773baaef26..256120d48f5 100644 --- a/lib/libc/hidden/syslog.h +++ b/lib/libc/hidden/syslog.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syslog.h,v 1.2 2015/10/31 02:57:16 deraadt Exp $ */ +/* $OpenBSD: syslog.h,v 1.3 2015/11/25 00:01:21 deraadt Exp $ */ /* * Copyright (c) 2015 Philip Guenther <guenther@openbsd.org> * @@ -23,6 +23,9 @@ int sendsyslog(const char *, __size_t); PROTO_NORMAL(sendsyslog); +int sendsyslog2(const char *, __size_t, int); +PROTO_NORMAL(sendsyslog2); + __BEGIN_HIDDEN_DECLS void __vsyslog_r(int, struct syslog_data *, int, const char *, __va_list); diff --git a/lib/libc/sys/Makefile.inc b/lib/libc/sys/Makefile.inc index a6cd01ed765..c2ef3ca72ee 100644 --- a/lib/libc/sys/Makefile.inc +++ b/lib/libc/sys/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.136 2015/11/10 04:30:59 guenther Exp $ +# $OpenBSD: Makefile.inc,v 1.137 2015/11/25 00:01:21 deraadt Exp $ # $NetBSD: Makefile.inc,v 1.35 1995/10/16 23:49:07 jtc Exp $ # @(#)Makefile.inc 8.1 (Berkeley) 6/17/93 @@ -50,7 +50,8 @@ ASM= __get_tcb.o __getcwd.o __semctl.o __set_tcb.o __syscall.o \ poll.o ppoll.o profil.o pselect.o \ quotactl.o read.o readlink.o readlinkat.o readv.o reboot.o \ recvfrom.o recvmsg.o rename.o renameat.o revoke.o rmdir.o \ - sched_yield.o select.o semget.o semop.o sendmsg.o sendsyslog.o sendto.o \ + sched_yield.o select.o semget.o semop.o sendmsg.o sendsyslog.o \ + sendsyslog2.o sendto.o \ setegid.o seteuid.o setgid.o setgroups.o setitimer.o \ setpgid.o setpriority.o setregid.o setresgid.o setresuid.o \ setreuid.o setrlimit.o setrtable.o setsid.o setsockopt.o \ |