From: Maks Mishin Date: Tue, 6 Feb 2024 23:54:16 +0000 (+0300) Subject: ctrl: Fix fd leak in ctrl_listen() X-Git-Tag: v6.8.0~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4dc6a784f6e2cee091027434f05a501f4cc1411;p=thirdparty%2Fiproute2.git ctrl: Fix fd leak in ctrl_listen() 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 Signed-off-by: Stephen Hemminger --- diff --git a/genl/ctrl.c b/genl/ctrl.c index bae73a54..72a9b013 100644 --- a/genl/ctrl.c +++ b/genl/ctrl.c @@ -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; }