1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

varlink: also handle EINTR gracefully when waiting for EIO via ppoll()

This commit is contained in:
Lennart Poettering 2022-11-22 12:42:46 +01:00
parent 7c75f34131
commit 6976bf5cd6

View File

@ -1025,7 +1025,7 @@ static void handle_revents(Varlink *v, int revents) {
if ((revents & (POLLOUT|POLLHUP)) == 0)
return;
varlink_log(v, "Anynchronous connection completed.");
varlink_log(v, "Asynchronous connection completed.");
v->connecting = false;
} else {
/* Note that we don't care much about POLLIN/POLLOUT here, we'll just try reading and writing
@ -1075,6 +1075,9 @@ int varlink_wait(Varlink *v, usec_t timeout) {
return events;
r = fd_wait_for_event(fd, events, t);
if (r < 0 && ERRNO_IS_TRANSIENT(r)) /* Treat EINTR as not a timeout, but also nothing happened, and
* the caller gets a chance to call back into us */
return 1;
if (r <= 0)
return r;
@ -1161,8 +1164,12 @@ int varlink_flush(Varlink *v) {
}
r = fd_wait_for_event(v->fd, POLLOUT, USEC_INFINITY);
if (r < 0)
if (r < 0) {
if (ERRNO_IS_TRANSIENT(r))
continue;
return varlink_log_errno(v, r, "Poll failed on fd: %m");
}
assert(r != 0);