summaryrefslogtreecommitdiff
path: root/serverloop.c
diff options
context:
space:
mode:
authordtucker <dtucker>2006-06-23 11:24:12 +0000
committerdtucker <dtucker>2006-06-23 11:24:12 +0000
commitb4cff29fd1f2d2c83b28ca4e398c082ff4da1126 (patch)
tree860fa235ff6e4c5a4a5ad8e934bc763d56451cf4 /serverloop.c
parentcb71a6683a06fdb39ec23f63e9c98680eff47ac5 (diff)
downloadopenssh-b4cff29fd1f2d2c83b28ca4e398c082ff4da1126.tar.gz
- (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 021ba68c..c1eb2885 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);