diff options
author | Matt Johnston <matt@ucc.asn.au> | 2014-07-09 00:13:17 +0800 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2014-07-09 00:13:17 +0800 |
commit | 1ccac01cee0222be332b46d7102336465760aa11 (patch) | |
tree | b569df842f267251bdaaf6d86db621ee953b8eaa /common-channel.c | |
parent | 50a5d3756fedee5078b756a686cc24213dcfcb02 (diff) |
Make sure client exit messages don't get lost
Diffstat (limited to 'common-channel.c')
-rw-r--r-- | common-channel.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/common-channel.c b/common-channel.c index 634d823..61b1120 100644 --- a/common-channel.c +++ b/common-channel.c @@ -574,14 +574,16 @@ static void remove_channel(struct Channel * channel) { } - /* close the FDs in case they haven't been done - * yet (they might have been shutdown etc) */ - TRACE(("CLOSE writefd %d", channel->writefd)) - close(channel->writefd); - TRACE(("CLOSE readfd %d", channel->readfd)) - close(channel->readfd); - TRACE(("CLOSE errfd %d", channel->errfd)) - close(channel->errfd); + if (IS_DROPBEAR_SERVER || (channel->writefd != STDOUT_FILENO)) { + /* close the FDs in case they haven't been done + * yet (they might have been shutdown etc) */ + TRACE(("CLOSE writefd %d", channel->writefd)) + close(channel->writefd); + TRACE(("CLOSE readfd %d", channel->readfd)) + close(channel->readfd); + TRACE(("CLOSE errfd %d", channel->errfd)) + close(channel->errfd); + } if (!channel->close_handler_done && channel->type->closehandler) { |