diff options
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/process.c b/src/process.c index dab701a9e7f..aa83422f8c1 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -3431,6 +3431,32 @@ send_process (proc, buf, len, object) | |||
| 3431 | Lisp_Object zero; | 3431 | Lisp_Object zero; |
| 3432 | int offset; | 3432 | int offset; |
| 3433 | 3433 | ||
| 3434 | #ifdef BROKEN_PTY_READ_AFTER_EAGAIN | ||
| 3435 | /* A gross hack to work around a bug in FreeBSD. | ||
| 3436 | In the following sequence, read(2) returns | ||
| 3437 | bogus data: | ||
| 3438 | |||
| 3439 | write(2) 1022 bytes | ||
| 3440 | write(2) 954 bytes, get EAGAIN | ||
| 3441 | read(2) 1024 bytes in process_read_output | ||
| 3442 | read(2) 11 bytes in process_read_output | ||
| 3443 | |||
| 3444 | That is, read(2) returns more bytes than have | ||
| 3445 | ever been written successfully. The 1033 bytes | ||
| 3446 | read are the 1022 bytes written successfully | ||
| 3447 | after processing (for example with CRs added if | ||
| 3448 | the terminal is set up that way which it is | ||
| 3449 | here). The same bytes will be seen again in a | ||
| 3450 | later read(2), without the CRs. */ | ||
| 3451 | |||
| 3452 | if (errno == EAGAIN) | ||
| 3453 | { | ||
| 3454 | int flags = FWRITE; | ||
| 3455 | ioctl (XINT (XPROCESS (proc)->outfd), TIOCFLUSH, | ||
| 3456 | &flags); | ||
| 3457 | } | ||
| 3458 | #endif /* BROKEN_PTY_READ_AFTER_EAGAIN */ | ||
| 3459 | |||
| 3434 | /* Running filters might relocate buffers or strings. | 3460 | /* Running filters might relocate buffers or strings. |
| 3435 | Arrange to relocate BUF. */ | 3461 | Arrange to relocate BUF. */ |
| 3436 | if (BUFFERP (object)) | 3462 | if (BUFFERP (object)) |