swtpm: Loop over poll() in case of EINTR

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Stefan Berger 2019-07-12 21:04:04 -04:00 committed by Stefan Berger
parent a442092d8e
commit ad2fb40077

View 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;