summaryrefslogtreecommitdiff
path: root/ssh.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh.c')
-rw-r--r--ssh.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/ssh.c b/ssh.c
index 9d5d9525e..862625432 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh.c,v 1.468 2017/10/27 01:57:06 djm Exp $ */ 1/* $OpenBSD: ssh.c,v 1.469 2017/11/01 00:04:15 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1906,13 +1906,15 @@ ssh_session2(struct ssh *ssh, struct passwd *pw)
1906 * NB. this can only happen after LocalCommand has completed, 1906 * NB. this can only happen after LocalCommand has completed,
1907 * as it may want to write to stdout. 1907 * as it may want to write to stdout.
1908 */ 1908 */
1909 if ((devnull = open(_PATH_DEVNULL, O_WRONLY)) == -1) 1909 if (!need_controlpersist_detach) {
1910 error("%s: open %s: %s", __func__, 1910 if ((devnull = open(_PATH_DEVNULL, O_WRONLY)) == -1)
1911 _PATH_DEVNULL, strerror(errno)); 1911 error("%s: open %s: %s", __func__,
1912 if (dup2(devnull, STDOUT_FILENO) < 0) 1912 _PATH_DEVNULL, strerror(errno));
1913 fatal("%s: dup2() stdout failed", __func__); 1913 if (dup2(devnull, STDOUT_FILENO) < 0)
1914 if (devnull > STDERR_FILENO) 1914 fatal("%s: dup2() stdout failed", __func__);
1915 close(devnull); 1915 if (devnull > STDERR_FILENO)
1916 close(devnull);
1917 }
1916 1918
1917 /* 1919 /*
1918 * If requested and we are not interested in replies to remote 1920 * If requested and we are not interested in replies to remote