summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@cvs.openbsd.org>2013-06-05 02:27:51 +0000
committerDarren Tucker <dtucker@cvs.openbsd.org>2013-06-05 02:27:51 +0000
commit7ec189cf838f0ded49aa3d4f00d7c7f764dcccab (patch)
treeabb08a19028d401eb0d745a1f28ced33824675fa /usr.bin
parent90edb487a57327280a2e55947d2b1e5b50701d1f (diff)
When running sshd -D, close stderr unless we have explicitly requesting
logging to stderr. From james.hunt at ubuntu.com via bz#1976, djm's patch so, err, ok dtucker.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/ssh/sshd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c
index dc95008cb66..76b7f2535be 100644
--- a/usr.bin/ssh/sshd.c
+++ b/usr.bin/ssh/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.402 2013/05/17 00:13:14 djm Exp $ */
+/* $OpenBSD: sshd.c,v 1.403 2013/06/05 02:27:50 dtucker Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -997,7 +997,9 @@ server_accept_inetd(int *sock_in, int *sock_out)
if ((fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
dup2(fd, STDIN_FILENO);
dup2(fd, STDOUT_FILENO);
- if (fd > STDOUT_FILENO)
+ if (!log_stderr)
+ dup2(fd, STDERR_FILENO);
+ if (fd > (log_stderr ? STDERR_FILENO : STDOUT_FILENO))
close(fd);
}
debug("inetd sockets after dupping: %d, %d", *sock_in, *sock_out);