summaryrefslogtreecommitdiff
path: root/usr.bin/ssh
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2017-11-01 00:04:16 +0000
committerDamien Miller <djm@cvs.openbsd.org>2017-11-01 00:04:16 +0000
commite35af7a5c444154edfa45fd68cc102dc652a567e (patch)
tree0e1fca52e1bffb88e50531711d98d6281c4ca930 /usr.bin/ssh
parent613527dfe49c0c6ea091e60da77c17e56e4f4bd8 (diff)
fix broken stdout in ControlPersist mode, introduced by me in r1.467
and reported by Alf Schlichting
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r--usr.bin/ssh/ssh.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/usr.bin/ssh/ssh.c b/usr.bin/ssh/ssh.c
index 536faa65c80..3eb956341c6 100644
--- a/usr.bin/ssh/ssh.c
+++ b/usr.bin/ssh/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.468 2017/10/27 01:57:06 djm Exp $ */
+/* $OpenBSD: ssh.c,v 1.469 2017/11/01 00:04:15 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1856,13 +1856,15 @@ ssh_session2(struct ssh *ssh, struct passwd *pw)
* NB. this can only happen after LocalCommand has completed,
* as it may want to write to stdout.
*/
- if ((devnull = open(_PATH_DEVNULL, O_WRONLY)) == -1)
- error("%s: open %s: %s", __func__,
- _PATH_DEVNULL, strerror(errno));
- if (dup2(devnull, STDOUT_FILENO) < 0)
- fatal("%s: dup2() stdout failed", __func__);
- if (devnull > STDERR_FILENO)
- close(devnull);
+ if (!need_controlpersist_detach) {
+ if ((devnull = open(_PATH_DEVNULL, O_WRONLY)) == -1)
+ error("%s: open %s: %s", __func__,
+ _PATH_DEVNULL, strerror(errno));
+ if (dup2(devnull, STDOUT_FILENO) < 0)
+ fatal("%s: dup2() stdout failed", __func__);
+ if (devnull > STDERR_FILENO)
+ close(devnull);
+ }
/*
* If requested and we are not interested in replies to remote