Message ID | 20240208172647.324168-3-stephen@networkplumber.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 8f340a07513858570cffcef7d5667a50a4f37458 |
Delegated to: | Stephen Hemminger |
Headers | show |
Series | [iproute2,1/3] ctrl: Fix fd leak in ctrl_listen() | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
diff --git a/ip/ipnetns.c b/ip/ipnetns.c index 0ae46a874a0c..594b2ef15d0c 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); }
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> --- ip/ipnetns.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)