timersub(&end, &now, &delta);
}
result = select(port->fd + 1, NULL, &fds, NULL, timeout ? &delta : NULL);
- if (result < 0)
- RETURN_FAIL("select() failed");
- if (result == 0) {
+ if (result < 0) {
+ if (errno == EINTR) {
+ DEBUG("select() call was interrupted, repeating");
+ continue;
+ } else {
+ RETURN_FAIL("select() failed");
+ }
+ } else if (result == 0) {
DEBUG("write timed out");
RETURN_VALUE("%d", bytes_written);
}
timersub(&end, &now, &delta);
}
result = select(port->fd + 1, &fds, NULL, NULL, timeout ? &delta : NULL);
- if (result < 0)
- RETURN_FAIL("select() failed");
- if (result == 0) {
+ if (result < 0) {
+ if (errno == EINTR) {
+ DEBUG("select() call was interrupted, repeating");
+ continue;
+ } else {
+ RETURN_FAIL("select() failed");
+ }
+ } else if (result == 0) {
DEBUG("read timed out");
RETURN_VALUE("%d", bytes_read);
}