diff options
author | Maks Mishin <maks.mishinfz@gmail.com> | 2024-02-07 02:54:16 +0300 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2024-02-08 09:21:39 -0800 |
commit | f4dc6a784f6e2cee091027434f05a501f4cc1411 (patch) | |
tree | 38d345c41cdd85f0f70cabb6557d9d8a0d5482ca | |
parent | 35c02157396c847e57f52b5d6d345af2b961a794 (diff) | |
download | iproute2-next-f4dc6a784f6e2cee091027434f05a501f4cc1411.tar.gz |
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 <maks.mishinFZ@gmail.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r-- | genl/ctrl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/genl/ctrl.c b/genl/ctrl.c index bae73a54b..72a9b0130 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; } |