EAGAIN means there are no more messages to read, so give up. EINTR means we got interrupted
reading a message, so try again.
size = recvmsg(fd, &msghdr, MSG_DONTWAIT);
if (size < 0) {
- if (errno == EAGAIN || errno == EINTR)
- return 1;
+ if (errno == EINTR)
+ continue;
+ else if (errno == EAGAIN)
+ /* nothing more to read */
+ break;
return log_error_errno(errno, "failed to receive message: %m");
} else if (size != sizeof(struct worker_message)) {