From f9f5a617b254d5c4cdfc630fae6ff329af86a39c Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Mon, 12 Nov 2018 20:27:25 +0000 Subject: [PATCH] Stop setting mc->eof_sent if we haven't. Looks as if I introduced this bug in commit 431f92ade, when I moved mainchan out into its own source file: the previous version of mainchan_send_eof conditionalised the setting of mc->eof_sent in the same if statement that actually sent the EOF, but somehow, in the new version, only one of those operations was inside the if. The effect is that in plink -nc mode, if the server sends EOF first, the client stops listening to standard input at its own end, so it never knows when to send EOF back and clean things up. --- mainchan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mainchan.c b/mainchan.c index ce991933..2224e4fb 100644 --- a/mainchan.c +++ b/mainchan.c @@ -386,9 +386,9 @@ static void mainchan_send_eof(Channel *chan) */ sshfwd_write_eof(mc->sc); ppl_logevent(("Sent EOF message")); + mc->eof_sent = true; + ssh_set_wants_user_input(mc->cl, false); /* stop reading from stdin */ } - mc->eof_sent = true; - ssh_set_wants_user_input(mc->cl, false); /* now stop reading from stdin */ } static void mainchan_set_input_wanted(Channel *chan, bool wanted)