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)
387 387
388 /* Read and buffer any available stdout data from the program. */ 388 /* Read and buffer any available stdout data from the program. */
389 if (!fdout_eof && FD_ISSET(fdout, readset)) { 389 if (!fdout_eof && FD_ISSET(fdout, readset)) {
390 errno = 0;
390 len = read(fdout, buf, sizeof(buf)); 391 len = read(fdout, buf, sizeof(buf));
391 if (len < 0 && (errno == EINTR || errno == EAGAIN)) { 392 if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
392 /* do nothing */ 393 /* do nothing */
394#ifdef PTY_ZEROREAD
393 } else if (len <= 0) { 395 } else if (len <= 0) {
396#else
397 } else if (len < 0 || (len == 0 && errno != 0)) {
398#endif
394 fdout_eof = 1; 399 fdout_eof = 1;
395 } else { 400 } else {
396 buffer_append(&stdout_buffer, buf, len); 401 buffer_append(&stdout_buffer, buf, len);
@@ -399,10 +404,15 @@ process_input(fd_set *readset)
399 } 404 }
400 /* Read and buffer any available stderr data from the program. */ 405 /* Read and buffer any available stderr data from the program. */
401 if (!fderr_eof && FD_ISSET(fderr, readset)) { 406 if (!fderr_eof && FD_ISSET(fderr, readset)) {
407 errno = 0;
402 len = read(fderr, buf, sizeof(buf)); 408 len = read(fderr, buf, sizeof(buf));
403 if (len < 0 && (errno == EINTR || errno == EAGAIN)) { 409 if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
404 /* do nothing */ 410 /* do nothing */
411#ifdef PTY_ZEROREAD
405 } else if (len <= 0) { 412 } else if (len <= 0) {
413#else
414 } else if (len < 0 || (len == 0 && errno != 0)) {
415#endif
406 fderr_eof = 1; 416 fderr_eof = 1;
407 } else { 417 } else {
408 buffer_append(&stderr_buffer, buf, len); 418 buffer_append(&stderr_buffer, buf, len);