diff options
author | bluhm <bluhm@openbsd.org> | 2017-03-26 18:38:16 +0000 |
---|---|---|
committer | bluhm <bluhm@openbsd.org> | 2017-03-26 18:38:16 +0000 |
commit | a4fe86f85e4d175ead0be0a9fd132d256601dfec (patch) | |
tree | 047a897e00157daabc50728e63c2518d61b0e1c9 /usr.sbin/syslogd | |
parent | Add "AVX" to the comment above the previous commit. Spotted by reyk (diff) | |
download | wireguard-openbsd-a4fe86f85e4d175ead0be0a9fd132d256601dfec.tar.xz wireguard-openbsd-a4fe86f85e4d175ead0be0a9fd132d256601dfec.zip |
After my previous commit, file descriptor fd_sendsys may be -1 if
socketpair(2) has failed. Do not call ioctl(LIOCSFD) in this case.
OK millert@
Diffstat (limited to 'usr.sbin/syslogd')
-rw-r--r-- | usr.sbin/syslogd/syslogd.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c index 67998959fe9..3910c1c2125 100644 --- a/usr.sbin/syslogd/syslogd.c +++ b/usr.sbin/syslogd/syslogd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: syslogd.c,v 1.231 2017/03/24 22:13:00 bluhm Exp $ */ +/* $OpenBSD: syslogd.c,v 1.232 2017/03/26 18:38:16 bluhm Exp $ */ /* * Copyright (c) 1983, 1988, 1993, 1994 @@ -565,11 +565,12 @@ main(int argc, char *argv[]) if ((fd_klog = open(_PATH_KLOG, O_RDONLY, 0)) == -1) { logdebug("can't open %s (%d)\n", _PATH_KLOG, errno); - } else { + } else if (fd_sendsys != -1) { if (ioctl(fd_klog, LIOCSFD, &pair[1]) == -1) logdebug("LIOCSFD errno %d\n", errno); } - close(pair[1]); + if (fd_sendsys != -1) + close(pair[1]); if (tls_init() == -1) { logerrorx("tls_init"); |