chiark / gitweb /
sd-rtnl: fix bogus warning about dropping 20 bytes from multi-part messages
authorTom Gundersen <teg@jklm.no>
Mon, 8 Dec 2014 17:36:16 +0000 (18:36 +0100)
committerTom Gundersen <teg@jklm.no>
Mon, 8 Dec 2014 17:38:55 +0000 (18:38 +0100)
Nothing was being dropped, we just failed to account for the NLMSG_DONE.

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

index 1112aa6b901e72f8cd1578bc29e0cc6021c1055a..ac920b2d3022b675ad75bef1ab9b712a80b10ea2 100644 (file)
@@ -1380,7 +1380,7 @@ int socket_read_message(sd_rtnl *rtnl) {
                 }
         }
 
-        for (new_msg = rtnl->rbuffer; NLMSG_OK(new_msg, len); new_msg = NLMSG_NEXT(new_msg, len)) {
+        for (new_msg = rtnl->rbuffer; NLMSG_OK(new_msg, len) && !done; new_msg = NLMSG_NEXT(new_msg, len)) {
                 _cleanup_rtnl_message_unref_ sd_rtnl_message *m = NULL;
                 const NLType *nl_type;
 
@@ -1395,7 +1395,8 @@ int socket_read_message(sd_rtnl *rtnl) {
                 if (new_msg->nlmsg_type == NLMSG_DONE) {
                         /* finished reading multi-part message */
                         done = true;
-                        break;
+
+                        continue;
                 }
 
                 /* check that we support this message type */