chiark / gitweb /
sd-rtnl: message - don't put NULL message on rqueue
authorTom Gundersen <teg@jklm.no>
Wed, 16 Apr 2014 16:17:24 +0000 (18:17 +0200)
committerTom Gundersen <teg@jklm.no>
Sat, 19 Apr 2014 14:47:52 +0000 (16:47 +0200)
If nothing interesting was receieved we should not put anything on
the queue.

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

index 47dcd4a..ffc19f1 100644 (file)
@@ -1194,12 +1194,17 @@ int socket_read_message(sd_rtnl *rtnl) {
                         break;
         }
 
-        r = rtnl_rqueue_make_room(rtnl);
-        if (r < 0)
-                return r;
+        if (first) {
+                r = rtnl_rqueue_make_room(rtnl);
+                if (r < 0)
+                        return r;
+
+                rtnl->rqueue[rtnl->rqueue_size ++] = first;
+                first = NULL;
+        }
 
-        rtnl->rqueue[rtnl->rqueue_size ++] = first;
-        first = NULL;
+        if (len)
+                log_debug("sd-rtnl: discarding %zu bytes of incoming message", len);
 
         return ret;
 }