Time: handle EINTR on select()

Change-Id: I8a1adc31541d2174d27729cfcd1bcb26e5d3e4fa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3728
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Axel Dörfler <[email protected]>
This commit is contained in:
Jérôme Duval
2021-02-01 19:35:02 +00:00
parent 08b9db66ac
commit 0376026d31
+6 -1
View File
@@ -172,7 +172,12 @@ ntp_update_time(const char* hostname, const char** errorString,
timeout.tv_usec = 0;
// we'll wait 3 seconds for the answer
if (select(connection + 1, &waitForReceived, NULL, NULL, &timeout) <= 0) {
int status;
do {
status = select(connection + 1, &waitForReceived, NULL, NULL,
&timeout);
} while (status == -1 && errno == EINTR);
if (status <= 0) {
*errorString = B_TRANSLATE("Waiting for answer failed");
*errorCode = errno;
close(connection);