changeset 4772:2c6033bfb871

(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.
author Brian Fox <bfox@gnu.org>
date Wed, 22 Sep 1993 18:08:51 +0000
parents d6ddaf79ea6a
children ae7c67879859
files src/sysdep.c
diffstat 1 files changed, 27 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/sysdep.c	Wed Sep 22 18:07:44 1993 +0000
+++ b/src/sysdep.c	Wed Sep 22 18:08:51 1993 +0000
@@ -2116,6 +2116,12 @@
   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 @@
      char *buf;
      unsigned int nbyte;
 {
-  register int rtnval;
-
-  while ((rtnval = write (fildes, buf, nbyte)) == -1
-	 && (errno == EINTR));
-  return (rtnval);
+  register int rtnval, bytes_written;
+
+  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 */