View | Details | Raw Unified | Return to bug 2797 | Differences between
and this patch

Collapse All | Expand All

(-)a/ssh.c (-1 / +15 lines)
Lines 1750-1756 ssh_session2_open(struct ssh *ssh) Link Here
1750
static int
1750
static int
1751
ssh_session2(struct ssh *ssh)
1751
ssh_session2(struct ssh *ssh)
1752
{
1752
{
1753
	int id = -1;
1753
	int devnull, id = -1;
1754
1754
1755
	/* XXX should be pre-session */
1755
	/* XXX should be pre-session */
1756
	if (!options.control_persist)
1756
	if (!options.control_persist)
Lines 1812-1817 ssh_session2(struct ssh *ssh) Link Here
1812
	    options.permit_local_command)
1812
	    options.permit_local_command)
1813
		ssh_local_cmd(options.local_command);
1813
		ssh_local_cmd(options.local_command);
1814
1814
1815
	/*
1816
	 * stdout is now owned by the session channel; clobber it here
1817
	 * so future channel closes are propagated to the local fd.
1818
	 * NB. this can only happen after LocalCommand has completed,
1819
	 * as it may want to write to stdout.
1820
	 */
1821
	if ((devnull = open(_PATH_DEVNULL, O_WRONLY)) == -1)
1822
		error("%s: open %s: %s", __func__,
1823
		    _PATH_DEVNULL, strerror(errno));
1824
	if (dup2(devnull, STDOUT_FILENO) < 0)
1825
		fatal("%s: dup2() stdout failed", __func__);
1826
	if (devnull > STDERR_FILENO)
1827
		close(devnull);
1828
1815
	/*
1829
	/*
1816
	 * If requested and we are not interested in replies to remote
1830
	 * If requested and we are not interested in replies to remote
1817
	 * forwarding requests, then let ssh continue in the background.
1831
	 * forwarding requests, then let ssh continue in the background.

Return to bug 2797