[PATCH 2/5] netlink: Break out sender_name

Ian Jackson ijackson at chiark.greenend.org.uk
Sat May 3 16:50:43 BST 2014


We are going to want to add another call site.

No functional change.

Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
---
 netlink.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/netlink.c b/netlink.c
index 41968e4..e53c339 100644
--- a/netlink.c
+++ b/netlink.c
@@ -237,6 +237,11 @@ struct icmphdr {
 
 static const union icmpinfofield icmp_noinfo;
     
+static const char *sender_name(struct netlink_client *sender /* or NULL */)
+{
+    return sender?sender->name:"(local)";
+}
+
 static void netlink_packet_deliver(struct netlink *st,
 				   struct netlink_client *client,
 				   struct buffer_if *buf);
@@ -615,7 +620,7 @@ static void netlink_packet_deliver(struct netlink *st,
 {
     if (buf->size < (int)sizeof(struct iphdr)) {
 	Message(M_ERR,"%s: trying to deliver a too-short packet"
-		" from %s!\n",st->name, sender?sender->name:"(local)");
+		" from %s!\n",st->name, sender_name(sender));
 	BUF_FREE(buf);
 	return;
     }
-- 
1.7.10.4




More information about the sgo-software-discuss mailing list