aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2024-02-08 09:25:08 -0800
committerStephen Hemminger <stephen@networkplumber.org>2024-02-08 09:25:08 -0800
commit8f340a07513858570cffcef7d5667a50a4f37458 (patch)
tree87fa42b8f9f9c7c1805f8072a2759d66eb05d1a3
parent00e8a64dac3be0203b149d3fe0307723ff76403e (diff)
downloadiproute2-8f340a07513858570cffcef7d5667a50a4f37458.tar.gz
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 <stephen@networkplumber.org>
-rw-r--r--ip/ipnetns.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ip/ipnetns.c b/ip/ipnetns.c
index 0ae46a874..594b2ef15 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);
}