[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220803082051.1704227-1-sunsuwan3@huawei.com>
Date: Wed, 3 Aug 2022 16:20:51 +0800
From: sunsuwan <sunsuwan3@...wei.com>
To: <netdev@...r.kernel.org>
CC: <sunsuwan3@...wei.com>, <chenzhen126@...wei.com>,
<liaichun@...wei.com>, <yanan@...wei.com>, <roopa@...dia.com>,
<nikolay@...dia.com>, <davem@...emloft.net>, <kuba@...nel.org>
Subject: [PATCH] bridge-utils:close socket before exit
brctl should close socket before exit.
Signed-off-by: sunsuwan <sunsuwan3@...wei.com>
---
brctl/brctl.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/brctl/brctl.c b/brctl/brctl.c
index 8855234..dd6c347 100644
--- a/brctl/brctl.c
+++ b/brctl/brctl.c
@@ -37,7 +37,7 @@ static void help()
int main(int argc, char *const* argv)
{
const struct command *cmd;
- int f;
+ int f, ret;
static const struct option options[] = {
{ .name = "help", .val = 'h' },
{ .name = "version", .val = 'V' },
@@ -70,16 +70,20 @@ int main(int argc, char *const* argv)
argv += optind;
if ((cmd = command_lookup(*argv)) == NULL) {
fprintf(stderr, "never heard of command [%s]\n", *argv);
+ br_shutdown();
goto help;
}
if (argc < cmd->nargs + 1) {
printf("Incorrect number of arguments for command\n");
printf("Usage: brctl %s %s\n", cmd->name, cmd->help);
+ br_shutdown();
return 1;
}
- return cmd->func(argc, argv);
+ ret = cmd->func(argc, argv);
+ br_shutdown();
+ return ret;
help:
help();
--
2.30.0
Powered by blists - more mailing lists