Time: handle EINTR on select()
Change-Id: I8a1adc31541d2174d27729cfcd1bcb26e5d3e4fa Reviewed-on: https://review.haiku-os.org/c/haiku/+/3728 Reviewed-by: waddlesplash <waddlesplash@gmail.com> Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
This commit is contained in:
parent
08b9db66ac
commit
0376026d31
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user