diff options
| author | Brian Fox | 1993-09-22 18:08:51 +0000 |
|---|---|---|
| committer | Brian Fox | 1993-09-22 18:08:51 +0000 |
| commit | b95520f5be0a99ed99b0b6edec62b3a8a52d5919 (patch) | |
| tree | 3037383c969f401fd56f4fa53768e9ef9d57f75f /src | |
| parent | 3df34fdb94525aba76320331837f39233cac2e72 (diff) | |
| download | emacs-b95520f5be0a99ed99b0b6edec62b3a8a52d5919.tar.gz emacs-b95520f5be0a99ed99b0b6edec62b3a8a52d5919.zip | |
(sys_write): Keep trying to write out the data until
all of the data is written, or until we receive an error which is
not an interrupted write.
Diffstat (limited to 'src')
| -rw-r--r-- | src/sysdep.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/sysdep.c b/src/sysdep.c index ba01fe56f67..7778bd862bc 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -2116,6 +2116,12 @@ read_input_waiting () | |||
| 2116 | e.modifiers = 0; | 2116 | e.modifiers = 0; |
| 2117 | for (i = 0; i < nread; i++) | 2117 | for (i = 0; i < nread; i++) |
| 2118 | { | 2118 | { |
| 2119 | /* If the user says she has a meta key, then believe her. */ | ||
| 2120 | if (meta_key == 1 && (buf[i] & 0x80)) | ||
| 2121 | e.modifiers = meta_modifier; | ||
| 2122 | if (meta_key != 2) | ||
| 2123 | buf[i] &= ~0x80; | ||
| 2124 | |||
| 2119 | XSET (e.code, Lisp_Int, buf[i]); | 2125 | XSET (e.code, Lisp_Int, buf[i]); |
| 2120 | kbd_buffer_store_event (&e); | 2126 | kbd_buffer_store_event (&e); |
| 2121 | /* Don't look at input that follows a C-g too closely. | 2127 | /* Don't look at input that follows a C-g too closely. |
| @@ -2586,11 +2592,27 @@ sys_write (fildes, buf, nbyte) | |||
| 2586 | char *buf; | 2592 | char *buf; |
| 2587 | unsigned int nbyte; | 2593 | unsigned int nbyte; |
| 2588 | { | 2594 | { |
| 2589 | register int rtnval; | 2595 | register int rtnval, bytes_written; |
| 2590 | 2596 | ||
| 2591 | while ((rtnval = write (fildes, buf, nbyte)) == -1 | 2597 | bytes_written = 0; |
| 2592 | && (errno == EINTR)); | 2598 | |
| 2593 | return (rtnval); | 2599 | while (nbyte > 0) |
| 2600 | { | ||
| 2601 | rtnval = write (fildes, buf, nbyte); | ||
| 2602 | |||
| 2603 | if (rtnval == -1) | ||
| 2604 | { | ||
| 2605 | if (errno == EINTR) | ||
| 2606 | continue; | ||
| 2607 | else | ||
| 2608 | return (-1); | ||
| 2609 | } | ||
| 2610 | |||
| 2611 | buf += rtnval; | ||
| 2612 | nbyte -= rtnval; | ||
| 2613 | bytes_written += rtnval; | ||
| 2614 | } | ||
| 2615 | return (bytes_written); | ||
| 2594 | } | 2616 | } |
| 2595 | 2617 | ||
| 2596 | #endif /* INTERRUPTIBLE_IO */ | 2618 | #endif /* INTERRUPTIBLE_IO */ |