From: Stephen Hemminger Date: Thu, 8 Feb 2024 17:25:08 +0000 (-0800) Subject: ip: detect rtnl_listen errors while monitoring netns X-Git-Tag: v6.8.0~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8f340a07513858570cffcef7d5667a50a4f37458;p=thirdparty%2Fiproute2.git ip: detect rtnl_listen errors while monitoring netns If rtnl_listen detects error (such as netlink socket EOF), then exit with status 2 like other iproute2 monitor commands. Signed-off-by: Stephen Hemminger --- diff --git a/ip/ipnetns.c b/ip/ipnetns.c index 0ae46a87..594b2ef1 100644 --- a/ip/ipnetns.c +++ b/ip/ipnetns.c @@ -96,7 +96,8 @@ static int ipnetns_have_nsid(void) close(fd); return 0; } - rtnl_listen(&rth, ipnetns_accept_msg, NULL); + if (rtnl_listen(&rth, ipnetns_accept_msg, NULL) < 0) + exit(2); close(fd); }