From: Tom Gundersen Date: Wed, 16 Apr 2014 16:17:24 +0000 (+0200) Subject: sd-rtnl: message - don't put NULL message on rqueue X-Git-Tag: v213~381 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=24a026737da3f108ba56c1c9fe7786b8173376d5 sd-rtnl: message - don't put NULL message on rqueue If nothing interesting was receieved we should not put anything on the queue. --- diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index 47dcd4a78..ffc19f1bb 100644 --- a/src/libsystemd/sd-rtnl/rtnl-message.c +++ b/src/libsystemd/sd-rtnl/rtnl-message.c @@ -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; }