From 24a026737da3f108ba56c1c9fe7786b8173376d5 Mon Sep 17 00:00:00 2001 From: Tom Gundersen Date: Wed, 16 Apr 2014 18:17:24 +0200 Subject: sd-rtnl: message - don't put NULL message on rqueue If nothing interesting was receieved we should not put anything on the queue. --- src/libsystemd/sd-rtnl/rtnl-message.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/libsystemd') diff --git a/src/libsystemd/sd-rtnl/rtnl-message.c b/src/libsystemd/sd-rtnl/rtnl-message.c index 47dcd4a782..ffc19f1bb6 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; } -- cgit v1.2.3-54-g00ecf