sd-rtnl: recv_message - drop message when peeking fails

Read the message form the socket or we will loop trying to read the
same message repeatedly.
This commit is contained in:
Tom Gundersen 2014-12-29 00:24:00 +01:00
parent 0b2bbbdf2f
commit c7460cce79

View file

@ -1377,9 +1377,17 @@ static int socket_recv_message(int fd, struct iovec *iov, uint32_t *_group, bool
}
}
if (!auth)
if (!auth) {
/* not from the kernel, ignore */
if (peek) {
/* drop the message */
r = recvmsg(fd, &msg, 0);
if (r < 0)
return (errno == EAGAIN || errno == EINTR) ? 0 : -errno;
}
return 0;
}
if (group)
*_group = group;