Skip to content

Commit

Permalink
sd-bus: fix bus_poll() to handle EINTR properly
Browse files Browse the repository at this point in the history
bus_ppoll() relies on ppoll(2) which can return EINTR when interrupted by a
signal. bus_ppoll() should be prepared to handle this case properly by
restarting the system call.

Hence let's make it call safe_ppoll_usec() instead since it does that
automatically for us.

This should address one of the cases that lead to the following error, which
might occur when shutting down the system:

 login[1489]: pam_systemd(login:session): Failed to release session: Interrupted system call

IOW this patch closes one possible root cause of issue systemd#18817.
  • Loading branch information
fbuihuu committed Nov 16, 2022
1 parent 601932e commit e1c8c37
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libsystemd/sd-bus/sd-bus.c
Expand Up @@ -3313,7 +3313,7 @@ static int bus_poll(sd_bus *bus, bool need_more, uint64_t timeout_usec) {
if (timeout_usec != UINT64_MAX && (m == USEC_INFINITY || timeout_usec < m))
m = timeout_usec;

r = ppoll_usec(p, n, m);
r = safe_ppoll_usec(p, n, m);
if (r <= 0)
return r;

Expand Down

0 comments on commit e1c8c37

Please sign in to comment.