diff mbox series

[iproute2,2/3] ip: detect errors in netconf monitor mode

Message ID 20240208172647.324168-2-stephen@networkplumber.org (mailing list archive)
State Accepted
Commit 00e8a64dac3be0203b149d3fe0307723ff76403e
Delegated to: Stephen Hemminger
Headers show
Series [iproute2,1/3] ctrl: Fix fd leak in ctrl_listen() | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Stephen Hemminger Feb. 8, 2024, 5:26 p.m. UTC
If rtnl_listen() returns error while looking for netconf events,
then exit with status of 2 as other iproute2 monitor actions do.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 ip/ipnetconf.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/ip/ipnetconf.c b/ip/ipnetconf.c
index 9ae6c45e7fd1..a0c7e051bac5 100644
--- a/ip/ipnetconf.c
+++ b/ip/ipnetconf.c
@@ -193,7 +193,8 @@  static int do_show(int argc, char **argv)
 			perror("Can not send request");
 			exit(1);
 		}
-		rtnl_listen(&rth, print_netconf, stdout);
+		if (rtnl_listen(&rth, print_netconf, stdout) < 0)
+			exit(2);
 	} else {
 		rth.flags = RTNL_HANDLE_F_SUPPRESS_NLERR;
 dump: