From 9c04d67d02cd4d53a7bba6fa06f0ce1112b0a62f Mon Sep 17 00:00:00 2001 From: dtucker Date: Sat, 24 Jun 2006 22:25:25 +0000 Subject: [PATCH] - (dtucker) [channels.c serverloop.c] Apply the bug #1102 workaround to ptys only, otherwise sshd can hang exiting non-interactive sessions. --- ChangeLog | 4 ++++ channels.c | 3 ++- serverloop.c | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index c03e172e..c3b6c233 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 diff --git a/channels.c b/channels.c index 239e9dd8..9642a56e 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 e370f63a..18f1a10b 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 { -- 2.45.2