Check all lseek calls succeed.

Also add missing TEMP_FAILURE_RETRYs on read, write, and lseek.

Bug: http://b/20625546
Change-Id: I03b198e11c1921b35518ee2dd005a7cfcf4fd94b
diff --git a/minzip/SysUtil.c b/minzip/SysUtil.c
index ac6f5c3..b160c9e 100644
--- a/minzip/SysUtil.c
+++ b/minzip/SysUtil.c
@@ -27,11 +27,13 @@
     assert(start_ != NULL);
     assert(length_ != NULL);
 
-    start = lseek(fd, 0L, SEEK_CUR);
-    end = lseek(fd, 0L, SEEK_END);
-    (void) lseek(fd, start, SEEK_SET);
+    // TODO: isn't start always 0 for the single call site? just use fstat instead?
 
-    if (start == (off_t) -1 || end == (off_t) -1) {
+    start = TEMP_FAILURE_RETRY(lseek(fd, 0L, SEEK_CUR));
+    end = TEMP_FAILURE_RETRY(lseek(fd, 0L, SEEK_END));
+
+    if (TEMP_FAILURE_RETRY(lseek(fd, start, SEEK_SET)) == -1 ||
+                start == (off_t) -1 || end == (off_t) -1) {
         LOGE("could not determine length of file\n");
         return -1;
     }
diff --git a/minzip/Zip.c b/minzip/Zip.c
index d3ff79b..40712e0 100644
--- a/minzip/Zip.c
+++ b/minzip/Zip.c
@@ -675,13 +675,11 @@
     }
     ssize_t soFar = 0;
     while (true) {
-        ssize_t n = write(fd, data+soFar, dataLen-soFar);
+        ssize_t n = TEMP_FAILURE_RETRY(write(fd, data+soFar, dataLen-soFar));
         if (n <= 0) {
             LOGE("Error writing %zd bytes from zip file from %p: %s\n",
                  dataLen-soFar, data+soFar, strerror(errno));
-            if (errno != EINTR) {
-              return false;
-            }
+            return false;
         } else if (n > 0) {
             soFar += n;
             if (soFar == dataLen) return true;