diff options
author | Tom Gundersen <teg@jklm.no> | 2014-12-29 00:24:00 +0100 |
---|---|---|
committer | Tom Gundersen <teg@jklm.no> | 2014-12-29 01:59:49 +0100 |
commit | c7460cce79fd358f2745bd390bd2e7ded450ee62 (patch) | |
tree | 83c758ae1662024ddc461151870d53b6aa4044ad /src/libsystemd | |
parent | 0b2bbbdf2f77d685a12862b96e764ac5f1ef8046 (diff) |
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.
Diffstat (limited to 'src/libsystemd')
-rw-r--r-- | src/libsystemd/sd-rtnl/rtnl-message.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index 92f318267e..640c0ea93e 100644 --- a/src/libsystemd/sd-rtnl/rtnl-message.c +++ b/src/libsystemd/sd-rtnl/rtnl-message.c @@ -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; |