summaryrefslogtreecommitdiff
path: root/serverloop.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2006-06-23 21:24:12 +1000
committerDarren Tucker <dtucker@zip.com.au>2006-06-23 21:24:12 +1000
commit9afe115f0ac738204d4edb66b9353a765826ae46 (patch)
treed7ba646ed3ae0c4ff86e95542fa4174f6d43f45d /serverloop.c
parent3eb4834489426bd796da90299b2f8174b744dddd (diff)
- (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@
Diffstat (limited to 'serverloop.c')
-rw-r--r--serverloop.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/serverloop.c b/serverloop.c
index 021ba68c0..c1eb28853 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -387,10 +387,15 @@ process_input(fd_set *readset)
/* Read and buffer any available stdout data from the program. */
if (!fdout_eof && FD_ISSET(fdout, readset)) {
+ errno = 0;
len = read(fdout, buf, sizeof(buf));
if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
/* do nothing */
+#ifdef PTY_ZEROREAD
} else if (len <= 0) {
+#else
+ } else if (len < 0 || (len == 0 && errno != 0)) {
+#endif
fdout_eof = 1;
} else {
buffer_append(&stdout_buffer, buf, len);
@@ -399,10 +404,15 @@ process_input(fd_set *readset)
}
/* Read and buffer any available stderr data from the program. */
if (!fderr_eof && FD_ISSET(fderr, readset)) {
+ errno = 0;
len = read(fderr, buf, sizeof(buf));
if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
/* do nothing */
+#ifdef PTY_ZEROREAD
} else if (len <= 0) {
+#else
+ } else if (len < 0 || (len == 0 && errno != 0)) {
+#endif
fderr_eof = 1;
} else {
buffer_append(&stderr_buffer, buf, len);