u8-istream: Retry read upon EINTR.
[pspp] / src / libpspp / u8-istream.c
index 77c14133eabb271da894859345ae73e85a9a65b0..b172b164f5c382c6055c205f0ea4f8e7ccc0f1c8 100644 (file)
@@ -194,8 +194,12 @@ fill_buffer (struct u8_istream *is)
   is->head = is->buffer;
 
   /* Read more input. */
-  n = read (is->fd, is->buffer + is->length,
-            U8_ISTREAM_BUFFER_SIZE - is->length);
+  do
+    {
+      n = read (is->fd, is->buffer + is->length,
+                U8_ISTREAM_BUFFER_SIZE - is->length);
+    }
+  while (n < 0 && errno == EINTR);
   if (n > 0)
     is->length += n;
   return n;