X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flibsystemd%2Fsd-rtnl%2Frtnl-message.c;h=640c0ea93eadf34f451ef9ce3a492923ccef122f;hb=c7460cce79fd358f2745bd390bd2e7ded450ee62;hp=cfb2af31420a37fae42df25c4c968bb25dc171bd;hpb=2263bb9a92f25571f837700cfee4fb79721baf46;p=elogind.git diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index cfb2af314..640c0ea93 100644 --- a/src/libsystemd/sd-rtnl/rtnl-message.c +++ b/src/libsystemd/sd-rtnl/rtnl-message.c @@ -1348,8 +1348,10 @@ static int socket_recv_message(int fd, struct iovec *iov, uint32_t *_group, bool /* no data */ if (errno == ENOBUFS) log_debug("rtnl: kernel receive buffer overrun"); + else if (errno == EAGAIN) + log_debug("rtnl: no data in socket"); - return (errno == EAGAIN) ? 0 : -errno; + return (errno == EAGAIN || errno == EINTR) ? 0 : -errno; } else if (r == 0) /* connection was closed by the kernel */ return -ECONNRESET; @@ -1375,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;