From 144e8d60cd3dcfdbf23c6df06617adf28b1235b8 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Sun, 25 Jun 2006 08:25:25 +1000 Subject: - (dtucker) [channels.c serverloop.c] Apply the bug #1102 workaround to ptys only, otherwise sshd can hang exiting non-interactive sessions. --- ChangeLog | 6 +++++- channels.c | 3 ++- serverloop.c | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index a33bc464b..10ffed226 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +20060625 + - (dtucker) [channels.c serverloop.c] Apply the bug #1102 workaround to ptys + only, otherwise sshd can hang exiting non-interactive sessions. + 20060624 - (dtucker) [configure.ac] Bug #1193: Define PASSWD_NEEDS_USERNAME on Solaris. Works around limitation in Solaris' passwd program for changing passwords @@ -4704,4 +4708,4 @@ - (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu -$Id: ChangeLog,v 1.4348 2006/06/24 06:58:45 dtucker Exp $ +$Id: ChangeLog,v 1.4349 2006/06/24 22:25:25 dtucker Exp $ diff --git a/channels.c b/channels.c index 239e9dd83..9642a56ee 100644 --- a/channels.c +++ b/channels.c @@ -1422,7 +1422,8 @@ channel_handle_rfd(Channel *c, fd_set *readset, fd_set *writeset) #ifndef PTY_ZEROREAD if (len <= 0) { #else - if (len < 0 || (len == 0 && errno != 0)) { + if ((!c->isatty && len <= 0) || + (c->isatty && (len < 0 || (len == 0 && errno != 0)))) { #endif debug2("channel %d: read<=0 rfd %d len %d", c->self, c->rfd, len); diff --git a/serverloop.c b/serverloop.c index e370f63a3..18f1a10bd 100644 --- a/serverloop.c +++ b/serverloop.c @@ -394,7 +394,8 @@ process_input(fd_set *readset) #ifndef PTY_ZEROREAD } else if (len <= 0) { #else - } else if (len < 0 || (len == 0 && errno != 0)) { + } else if ((!isatty(fdout) && len <= 0) || + (isatty(fdout) && (len < 0 || (len == 0 && errno != 0)))) { #endif fdout_eof = 1; } else { @@ -411,7 +412,8 @@ process_input(fd_set *readset) #ifndef PTY_ZEROREAD } else if (len <= 0) { #else - } else if (len < 0 || (len == 0 && errno != 0)) { + } else if ((!isatty(fderr) && len <= 0) || + (isatty(fderr) && (len < 0 || (len == 0 && errno != 0)))) { #endif fderr_eof = 1; } else { -- cgit v1.2.3