diff options
| author | Liu Jing <[email protected]> | 2024-07-27 09:04:03 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2024-07-29 12:31:27 +0000 |
| commit | 7c70bcc2a84cf925f655ea1ac4b8088062b144a3 (patch) | |
| tree | 402867947e6b51f15027dafd583d0fc5fc09fcd1 | |
| parent | selftests: mptcp: fix error path (diff) | |
| download | kernel-7c70bcc2a84cf925f655ea1ac4b8088062b144a3.tar.gz kernel-7c70bcc2a84cf925f655ea1ac4b8088062b144a3.zip | |
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: 05be5e273c84 ("selftests: mptcp: add disconnect tests")
Cc: [email protected]
Signed-off-by: Liu Jing <[email protected]>
Reviewed-by: Matthieu Baerts (NGI0) <[email protected]>
Signed-off-by: Matthieu Baerts (NGI0) <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
| -rw-r--r-- | tools/testing/selftests/net/mptcp/mptcp_connect.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.c b/tools/testing/selftests/net/mptcp/mptcp_connect.c index d2043ec3bf6d..4209b9569039 100644 --- a/tools/testing/selftests/net/mptcp/mptcp_connect.c +++ b/tools/testing/selftests/net/mptcp/mptcp_connect.c @@ -1115,11 +1115,11 @@ again: return 1; } - if (--cfg_repeat > 0) { - if (cfg_input) - close(fd); + if (cfg_input) + close(fd); + + if (--cfg_repeat > 0) goto again; - } return 0; } |
