]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ip: detect rtnl_listen errors while monitoring netns
authorStephen Hemminger <stephen@networkplumber.org>
Thu, 8 Feb 2024 17:25:08 +0000 (09:25 -0800)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 8 Feb 2024 17:25:08 +0000 (09:25 -0800)
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

index 0ae46a874a0c9d8914d4173a4c59a5010eae6aa6..594b2ef15d0cce0fc777881e8b3450c4dec6c29a 100644 (file)
@@ -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);
        }