Skip to content

Commit c183165

Browse files
Geliang Tangkuba-moo
authored andcommitted
selftests: mptcp: close fd_in before returning in main_loop
The file descriptor 'fd_in' is opened when cfg_input is configured, but not closed in main_loop(), this patch fixes it. Fixes: 05be5e2 ("selftests: mptcp: add disconnect tests") Cc: [email protected] Co-developed-by: Cong Liu <[email protected]> Signed-off-by: Cong Liu <[email protected]> Signed-off-by: Geliang Tang <[email protected]> Reviewed-by: Matthieu Baerts (NGI0) <[email protected]> Signed-off-by: Matthieu Baerts (NGI0) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7335d4a commit c183165

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/testing/selftests/net/mptcp/mptcp_connect.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,7 @@ int main_loop(void)
12991299

13001300
ret = copyfd_io(fd_in, fd, 1, 0, &winfo);
13011301
if (ret)
1302-
return ret;
1302+
goto out;
13031303

13041304
if (cfg_truncate > 0) {
13051305
shutdown(fd, SHUT_WR);
@@ -1320,7 +1320,10 @@ int main_loop(void)
13201320
close(fd);
13211321
}
13221322

1323-
return 0;
1323+
out:
1324+
if (cfg_input)
1325+
close(fd_in);
1326+
return ret;
13241327
}
13251328

13261329
int parse_proto(const char *proto)

0 commit comments

Comments
 (0)