]> code.delx.au - gnu-emacs/commitdiff
(sys_write): Keep trying to write out the data until
authorBrian Fox <bfox@gnu.org>
Wed, 22 Sep 1993 18:08:51 +0000 (18:08 +0000)
committerBrian Fox <bfox@gnu.org>
Wed, 22 Sep 1993 18:08:51 +0000 (18:08 +0000)
all of the data is written, or until we receive an error which is
not an interrupted write.

src/sysdep.c

index ba01fe56f67fceef6b2a1cd9c6571d30f8cf1f60..7778bd862bcf960ccd54790d0f65e55ad6cf9b30 100644 (file)
@@ -2116,6 +2116,12 @@ read_input_waiting ()
   e.modifiers = 0;
   for (i = 0; i < nread; i++)
     {
+      /* If the user says she has a meta key, then believe her. */
+      if (meta_key == 1 && (buf[i] & 0x80))
+       e.modifiers = meta_modifier;
+      if (meta_key != 2)
+       buf[i] &= ~0x80;
+
       XSET (e.code, Lisp_Int, buf[i]);
       kbd_buffer_store_event (&e);
       /* Don't look at input that follows a C-g too closely.
@@ -2586,11 +2592,27 @@ sys_write (fildes, buf, nbyte)
      char *buf;
      unsigned int nbyte;
 {
-  register int rtnval;
+  register int rtnval, bytes_written;
 
-  while ((rtnval = write (fildes, buf, nbyte)) == -1
-        && (errno == EINTR));
-  return (rtnval);
+  bytes_written = 0;
+
+  while (nbyte > 0)
+    {
+      rtnval = write (fildes, buf, nbyte);
+
+      if (rtnval == -1)
+       {
+         if (errno == EINTR)
+           continue;
+         else
+           return (-1);
+       }
+
+      buf += rtnval;
+      nbyte -= rtnval;
+      bytes_written += rtnval;
+    }
+  return (bytes_written);
 }
 
 #endif /* INTERRUPTIBLE_IO */