|
Lines 255-260
wait_until_can_do_something(fd_set **rea
Link Here
|
| 255 |
struct timeval tv, *tvp; |
255 |
struct timeval tv, *tvp; |
| 256 |
int ret; |
256 |
int ret; |
| 257 |
int client_alive_scheduled = 0; |
257 |
int client_alive_scheduled = 0; |
|
|
258 |
int program_alive_scheduled = 0; |
| 258 |
|
259 |
|
| 259 |
/* |
260 |
/* |
| 260 |
* if using client_alive, set the max timeout accordingly, |
261 |
* if using client_alive, set the max timeout accordingly, |
|
Lines 292-297
wait_until_can_do_something(fd_set **rea
Link Here
|
| 292 |
* the client, try to get some more data from the program. |
293 |
* the client, try to get some more data from the program. |
| 293 |
*/ |
294 |
*/ |
| 294 |
if (packet_not_very_much_data_to_write()) { |
295 |
if (packet_not_very_much_data_to_write()) { |
|
|
296 |
program_alive_scheduled = child_terminated; |
| 295 |
if (!fdout_eof) |
297 |
if (!fdout_eof) |
| 296 |
FD_SET(fdout, *readsetp); |
298 |
FD_SET(fdout, *readsetp); |
| 297 |
if (!fderr_eof) |
299 |
if (!fderr_eof) |
|
Lines 337-344
wait_until_can_do_something(fd_set **rea
Link Here
|
| 337 |
memset(*writesetp, 0, *nallocp); |
339 |
memset(*writesetp, 0, *nallocp); |
| 338 |
if (errno != EINTR) |
340 |
if (errno != EINTR) |
| 339 |
error("select: %.100s", strerror(errno)); |
341 |
error("select: %.100s", strerror(errno)); |
| 340 |
} else if (ret == 0 && client_alive_scheduled) |
342 |
} else { |
| 341 |
client_alive_check(); |
343 |
if (ret == 0 && client_alive_scheduled) |
|
|
344 |
client_alive_check(); |
| 345 |
if (program_alive_scheduled && fdin_is_tty) { |
| 346 |
if (!fdout_eof) |
| 347 |
FD_SET(fdout, *readsetp); |
| 348 |
if (!fderr_eof) |
| 349 |
FD_SET(fderr, *readsetp); |
| 350 |
} |
| 351 |
} |
| 342 |
|
352 |
|
| 343 |
notify_done(*readsetp); |
353 |
notify_done(*readsetp); |
| 344 |
} |
354 |
} |
|
Lines 381-387
process_input(fd_set * readset)
Link Here
|
| 381 |
/* Read and buffer any available stdout data from the program. */ |
391 |
/* Read and buffer any available stdout data from the program. */ |
| 382 |
if (!fdout_eof && FD_ISSET(fdout, readset)) { |
392 |
if (!fdout_eof && FD_ISSET(fdout, readset)) { |
| 383 |
len = read(fdout, buf, sizeof(buf)); |
393 |
len = read(fdout, buf, sizeof(buf)); |
| 384 |
if (len < 0 && (errno == EINTR || errno == EAGAIN)) { |
394 |
if (len < 0 && errno == EINTR) { |
| 385 |
/* do nothing */ |
395 |
/* do nothing */ |
| 386 |
} else if (len <= 0) { |
396 |
} else if (len <= 0) { |
| 387 |
fdout_eof = 1; |
397 |
fdout_eof = 1; |
|
Lines 393-399
process_input(fd_set * readset)
Link Here
|
| 393 |
/* Read and buffer any available stderr data from the program. */ |
403 |
/* Read and buffer any available stderr data from the program. */ |
| 394 |
if (!fderr_eof && FD_ISSET(fderr, readset)) { |
404 |
if (!fderr_eof && FD_ISSET(fderr, readset)) { |
| 395 |
len = read(fderr, buf, sizeof(buf)); |
405 |
len = read(fderr, buf, sizeof(buf)); |
| 396 |
if (len < 0 && (errno == EINTR || errno == EAGAIN)) { |
406 |
if (len < 0 && errno == EINTR) { |
| 397 |
/* do nothing */ |
407 |
/* do nothing */ |
| 398 |
} else if (len <= 0) { |
408 |
} else if (len <= 0) { |
| 399 |
fderr_eof = 1; |
409 |
fderr_eof = 1; |