]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip: detect errors in netconf monitor mode
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 8 Feb 2024 17:23:07 +0000 (09:23 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 8 Feb 2024 17:23:07 +0000 (09:23 -0800)
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

index 9ae6c45e7fd157d6b06d09f951f5f5977f9e01e4..a0c7e051bac5682718fccd1cadbc3e62bf895e8f 100644 (file)
@@ -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: