]> git.proxmox.com Git - swtpm.git/commitdiff
swtpm: Loop over poll() in case of EINTR
authorStefan Berger <stefanb@linux.vnet.ibm.com>
Sat, 13 Jul 2019 01:04:04 +0000 (21:04 -0400)
committerStefan Berger <stefanb@us.ibm.com>
Sat, 13 Jul 2019 16:48:36 +0000 (12:48 -0400)
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
src/swtpm/ctrlchannel.c

index e67bab9187c1d7abf46f74ca46ee50ac4560c1bc..8b56cd867697bc88fc50f2b3d92fc8f06c59db11 100644 (file)
@@ -416,9 +416,14 @@ wait_chunk:
         to = timeout.tv_sec * 1000 + timeout.tv_nsec / 1E6;
 
         /* wait for the next chunk */
-        n = poll(&pollfd, 1, to);
-        if (n <= 0)
-            return n;
+        while (true) {
+            n = poll(&pollfd, 1, to);
+            if (n < 0 && errno == EINTR)
+                continue;
+            if (n <= 0)
+                return n;
+            break;
+        }
         /* we should have data now */
     }
     return recvd;