]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ctrl: Fix fd leak in ctrl_listen()
authorMaks Mishin <maks.mishinfz@gmail.com>
Tue, 6 Feb 2024 23:54:16 +0000 (02:54 +0300)
committerStephen Hemminger <stephen@networkplumber.org>
Thu, 8 Feb 2024 17:21:39 +0000 (09:21 -0800)
Use the same pattern for handling rtnl_listen() errors that
is used across other iproute2 commands. All other commands
exit with status of 2 if rtnl_listen fails.

Reported-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
genl/ctrl.c

index bae73a54bc37e595bff06f914b9dbfad9d4a83b0..72a9b01302cf4b4d97b03f849010f652bacf8597 100644 (file)
@@ -334,8 +334,9 @@ static int ctrl_listen(int argc, char **argv)
        }
 
        if (rtnl_listen(&rth, print_ctrl, (void *) stdout) < 0)
-               return -1;
-
+               exit(2);
+       
+       rtnl_close(&rth);       
        return 0;
 }