chiark / gitweb /
sd-rtnl: don't fall over when receiving 0 bytes from the socket
authorTom Gundersen <teg@jklm.no>
Fri, 6 Feb 2015 10:54:30 +0000 (11:54 +0100)
committerTom Gundersen <teg@jklm.no>
Fri, 6 Feb 2015 11:10:07 +0000 (12:10 +0100)
causes EOF. Seems like a kernel bug. Ignoring it seems to work be the best we
can do for now...

See https://bugs.freedesktop.org/show_bug.cgi?id=88397

src/libsystemd/sd-rtnl/rtnl-message.c

index 23253029e5fefbc4ed69e25fda18da24dd1bf339..f072899433ec7440f72f0c1acf9a994b461fb7ce 100644 (file)
@@ -1350,9 +1350,11 @@ static int socket_recv_message(int fd, struct iovec *iov, uint32_t *_group, bool
                         log_debug("rtnl: no data in socket");
 
                 return (errno == EAGAIN || errno == EINTR) ? 0 : -errno;
                         log_debug("rtnl: no data in socket");
 
                 return (errno == EAGAIN || errno == EINTR) ? 0 : -errno;
-        } else if (r == 0)
-                /* connection was closed by the kernel */
-                return -ECONNRESET;
+        } else if (r == 0) {
+                /* connection was closed by the kernel? */
+                log_warning("rtnl: ignoring empty message");
+                return 0;
+        }
 
         for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
                 if (cmsg->cmsg_level == SOL_SOCKET &&
 
         for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
                 if (cmsg->cmsg_level == SOL_SOCKET &&