From 9afe115f0ac738204d4edb66b9353a765826ae46 Mon Sep 17 00:00:00 2001 From: Darren Tucker Date: Fri, 23 Jun 2006 21:24:12 +1000 Subject: - (dtucker) [channels.c configure.ac serverloop.c] Bug #1102: Around AIX 4.3.3 ML3 or so, the AIX pty layer starting passing zero-length writes on the pty slave as zero-length reads on the pty master, which sshd interprets as the descriptor closing. Since most things don't do zero length writes this rarely matters, but occasionally it happens, and when it does the SSH pty session appears to hang, so we add a special case for this condition. ok djm@ --- channels.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'channels.c') diff --git a/channels.c b/channels.c index 2fa997edc..239e9dd83 100644 --- a/channels.c +++ b/channels.c @@ -1415,10 +1415,15 @@ channel_handle_rfd(Channel *c, fd_set *readset, fd_set *writeset) if (c->rfd != -1 && FD_ISSET(c->rfd, readset)) { + errno = 0; len = read(c->rfd, buf, sizeof(buf)); if (len < 0 && (errno == EINTR || errno == EAGAIN)) return 1; +#ifndef PTY_ZEROREAD if (len <= 0) { +#else + if (len < 0 || (len == 0 && errno != 0)) { +#endif debug2("channel %d: read<=0 rfd %d len %d", c->self, c->rfd, len); if (c->type != SSH_CHANNEL_OPEN) { -- cgit v1.2.3