|
Lines 280-286
wait_until_can_do_something(fd_set **rea
Link Here
|
| 280 |
struct timeval tv, *tvp; |
280 |
struct timeval tv, *tvp; |
| 281 |
int ret; |
281 |
int ret; |
| 282 |
int client_alive_scheduled = 0; |
282 |
int client_alive_scheduled = 0; |
| 283 |
int program_alive_scheduled = 0; |
|
|
| 284 |
|
283 |
|
| 285 |
/* |
284 |
/* |
| 286 |
* if using client_alive, set the max timeout accordingly, |
285 |
* if using client_alive, set the max timeout accordingly, |
|
Lines 318-324
wait_until_can_do_something(fd_set **rea
Link Here
|
| 318 |
* the client, try to get some more data from the program. |
317 |
* the client, try to get some more data from the program. |
| 319 |
*/ |
318 |
*/ |
| 320 |
if (packet_not_very_much_data_to_write()) { |
319 |
if (packet_not_very_much_data_to_write()) { |
| 321 |
program_alive_scheduled = child_terminated; |
|
|
| 322 |
if (!fdout_eof) |
320 |
if (!fdout_eof) |
| 323 |
FD_SET(fdout, *readsetp); |
321 |
FD_SET(fdout, *readsetp); |
| 324 |
if (!fderr_eof) |
322 |
if (!fderr_eof) |
|
Lines 364-379
wait_until_can_do_something(fd_set **rea
Link Here
|
| 364 |
memset(*writesetp, 0, *nallocp); |
362 |
memset(*writesetp, 0, *nallocp); |
| 365 |
if (errno != EINTR) |
363 |
if (errno != EINTR) |
| 366 |
error("select: %.100s", strerror(errno)); |
364 |
error("select: %.100s", strerror(errno)); |
| 367 |
} else { |
365 |
} else if (ret == 0 && client_alive_scheduled) |
| 368 |
if (ret == 0 && client_alive_scheduled) |
366 |
client_alive_check(); |
| 369 |
client_alive_check(); |
|
|
| 370 |
if (!compat20 && program_alive_scheduled && fdin_is_tty) { |
| 371 |
if (!fdout_eof) |
| 372 |
FD_SET(fdout, *readsetp); |
| 373 |
if (!fderr_eof) |
| 374 |
FD_SET(fderr, *readsetp); |
| 375 |
} |
| 376 |
} |
| 377 |
|
367 |
|
| 378 |
notify_done(*readsetp); |
368 |
notify_done(*readsetp); |
| 379 |
} |
369 |
} |
|
Lines 417-424
process_input(fd_set *readset)
Link Here
|
| 417 |
if (!fdout_eof && FD_ISSET(fdout, readset)) { |
407 |
if (!fdout_eof && FD_ISSET(fdout, readset)) { |
| 418 |
errno = 0; |
408 |
errno = 0; |
| 419 |
len = read(fdout, buf, sizeof(buf)); |
409 |
len = read(fdout, buf, sizeof(buf)); |
| 420 |
if (len < 0 && (errno == EINTR || |
410 |
if (len < 0 && (errno == EINTR || errno == EAGAIN)) { |
| 421 |
(errno == EAGAIN && !child_terminated))) { |
|
|
| 422 |
/* do nothing */ |
411 |
/* do nothing */ |
| 423 |
#ifndef PTY_ZEROREAD |
412 |
#ifndef PTY_ZEROREAD |
| 424 |
} else if (len <= 0) { |
413 |
} else if (len <= 0) { |
|
Lines 436-443
process_input(fd_set *readset)
Link Here
|
| 436 |
if (!fderr_eof && FD_ISSET(fderr, readset)) { |
425 |
if (!fderr_eof && FD_ISSET(fderr, readset)) { |
| 437 |
errno = 0; |
426 |
errno = 0; |
| 438 |
len = read(fderr, buf, sizeof(buf)); |
427 |
len = read(fderr, buf, sizeof(buf)); |
| 439 |
if (len < 0 && (errno == EINTR || |
428 |
if (len < 0 && (errno == EINTR || errno == EAGAIN)) { |
| 440 |
(errno == EAGAIN && !child_terminated))) { |
|
|
| 441 |
/* do nothing */ |
429 |
/* do nothing */ |
| 442 |
#ifndef PTY_ZEROREAD |
430 |
#ifndef PTY_ZEROREAD |
| 443 |
} else if (len <= 0) { |
431 |
} else if (len <= 0) { |