EINTR obvserved on reads and writes.
[egate.git] / util / gip.c
index f0c02a4..8265d49 100644 (file)
@@ -2,7 +2,10 @@
  * Europagate, 1995
  *
  * $Log: gip.c,v $
- * Revision 1.5  1995/05/01 16:27:28  adam
+ * Revision 1.6  1995/05/02 15:26:52  adam
+ * EINTR obvserved on reads and writes.
+ *
+ * Revision 1.5  1995/05/01  16:27:28  adam
  * Various improvements. Close-on-exec and close on failure on either
  * read or write FIFO.
  *
@@ -83,12 +86,17 @@ int gip_read (GIP gip, char *buf, size_t count)
     int r, no = 0;
     while (no < count)
     {
-        r = read (gip->rfd, buf+no, count-no);
-       if (r == -1)
-       {
-           gip->errno = errno;
-           return -1;
-       }
+        while (1)
+        {
+            r = read (gip->rfd, buf+no, count-no);
+            if (r != -1)
+                break;
+            if (errno != EINTR)
+            {
+                gip->errno = errno;
+                return -1;
+            }
+        }
        no += r;
     }
     return 0;
@@ -99,11 +107,16 @@ int gip_write (GIP gip, const char *buf, size_t count)
     int r, no = 0;
     while (no < count)
     {
-        r = write (gip->wfd, buf+no, count-no);
-       if (r == -1)
-       {
-           gip->errno = errno;
-           return -1;
+        while (1)
+        {
+            r = write (gip->wfd, buf+no, count-no);
+            if (r != -1)
+                break;
+            if (errno != EINTR)
+            {
+                gip->errno = errno;
+                return -1;
+            }
        }
        no += r;
     }