upstream commit

fix broken stdout in ControlPersist mode, introduced by me in
r1.467 and reported by Alf Schlichting

OpenBSD-Commit-ID: 3750a16e02108fc25f747e4ebcedb7123c1ef509
This commit is contained in:
djm@openbsd.org@openbsd.org 2017-11-01 00:04:15 +00:00 committed by Damien Miller
parent f21455a084
commit 939b30ba23
1 changed files with 10 additions and 8 deletions

4
ssh.c
View File

@ -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> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -1906,6 +1906,7 @@ ssh_session2(struct ssh *ssh, struct passwd *pw)
* NB. this can only happen after LocalCommand has completed, * NB. this can only happen after LocalCommand has completed,
* as it may want to write to stdout. * as it may want to write to stdout.
*/ */
if (!need_controlpersist_detach) {
if ((devnull = open(_PATH_DEVNULL, O_WRONLY)) == -1) if ((devnull = open(_PATH_DEVNULL, O_WRONLY)) == -1)
error("%s: open %s: %s", __func__, error("%s: open %s: %s", __func__,
_PATH_DEVNULL, strerror(errno)); _PATH_DEVNULL, strerror(errno));
@ -1913,6 +1914,7 @@ ssh_session2(struct ssh *ssh, struct passwd *pw)
fatal("%s: dup2() stdout failed", __func__); fatal("%s: dup2() stdout failed", __func__);
if (devnull > STDERR_FILENO) if (devnull > STDERR_FILENO)
close(devnull); close(devnull);
}
/* /*
* If requested and we are not interested in replies to remote * If requested and we are not interested in replies to remote