diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2015-10-23 16:28:53 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2015-10-23 16:28:53 +0000 |
commit | 919a984095973cec3aae18f5750403a92223ba86 (patch) | |
tree | 87b2a3ad21927c4347a17c1aea1f4115a52366ba /usr.sbin/syslogd/syslogd.c | |
parent | caadbafe5670de3789c5b0c9adc5bcce2e26eb49 (diff) |
If writing to a tty blocks, syslogd forked and tried to write again
in a background process. A potential fork(2) at every message is
bad, so replace this with an event. As a bonus the syslogd child
process does not need to pledge "proc" anymore. Also limit the
number of delayed write events.
OK deraadt@
Diffstat (limited to 'usr.sbin/syslogd/syslogd.c')
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 4bde888d37a..e9806203210 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syslogd.c,v 1.199 2015/10/21 14:03:07 bluhm Exp $ */ +/* $OpenBSD: syslogd.c,v 1.200 2015/10/23 16:28:52 bluhm Exp $ */ /* * Copyright (c) 1983, 1988, 1993, 1994 @@ -53,7 +53,6 @@ * IPv6, libevent, syslog over TCP and TLS by Alexander Bluhm */ -#define MAXLINE 8192 /* maximum line length */ #define MAX_UDPMSG 1180 /* maximum UDP send size */ #define MIN_MEMBUF (MAXLINE * 4) /* Minimum memory buffer size */ #define MAX_MEMBUF (256 * 1024) /* Maximum memory buffer size */ @@ -701,7 +700,7 @@ main(int argc, char *argv[]) if (priv_init(ConfFile, NoDNS, lockpipe[1], nullfd, argv) < 0) errx(1, "unable to privsep"); - if (pledge("stdio rpath unix inet proc recvfd", NULL) == -1) + if (pledge("stdio rpath unix inet recvfd", NULL) == -1) err(1, "pledge"); /* Process is now unprivileged and inside a chroot */ @@ -1952,8 +1951,7 @@ wallmsg(struct filed *f, struct iovec *iov) break; if (!strncmp(f->f_un.f_uname[i], ut.ut_name, UT_NAMESIZE)) { - if ((p = ttymsg(iov, 6, utline)) - != NULL) + if ((p = ttymsg(iov, 6, utline)) != NULL) logerrorx(p); break; } |