Commit 7c70bcc2 authored by Liu Jing's avatar Liu Jing Committed by David S. Miller

selftests: mptcp: always close input's FD if opened

In main_loop_s function, when the open(cfg_input, O_RDONLY) function is
run, the last fd is not closed if the "--cfg_repeat > 0" branch is not
taken.

Fixes: 05be5e27 ("selftests: mptcp: add disconnect tests")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarLiu Jing <liujing@cmss.chinamobile.com>
Reviewed-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarMatthieu Baerts (NGI0) <matttbe@kernel.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4a2f4899
......@@ -1115,11 +1115,11 @@ int main_loop_s(int listensock)
return 1;
}
if (--cfg_repeat > 0) {
if (cfg_input)
close(fd);
if (cfg_input)
close(fd);
if (--cfg_repeat > 0)
goto again;
}
return 0;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment