diff options
Diffstat (limited to 'serverloop.c')
-rw-r--r-- | serverloop.c | 10 |
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); |