[LTP] [PATCH] accept02: Add SAFE_FORK to clean CLOSE_WAIT fds
zhaogongyi
zhaogongyi@huawei.com
Thu Mar 24 03:27:50 CET 2022
Hi Cyril,
Thanks for your review! Yes, I cann't the clone_server_sockfd is not closed before,
and I will resubmit a patch, please see: https://patchwork.ozlabs.org/project/ltp/patch/20220324022455.245300-1-zhaogongyi@huawei.com/
Best regards,
Gongyi
>
> Hi!
> As far as I can tell we should rather close the fd returned from the
> accept() call like this:
>
> diff --git a/testcases/kernel/syscalls/accept/accept02.c
> b/testcases/kernel/syscalls/accept/accept02.c
> index 12a1e3ca3..b2d27a260 100644
> --- a/testcases/kernel/syscalls/accept/accept02.c
> +++ b/testcases/kernel/syscalls/accept/accept02.c
> @@ -68,6 +68,8 @@ static void *server_thread(void *arg)
> TEST(setsockopt(clone_server_sockfd, SOL_IP,
> MCAST_LEAVE_GROUP,
> mc_group, mc_group_len));
>
> + SAFE_CLOSE(clone_server_sockfd);
> +
> if (TST_RET != -1)
> tst_res(TFAIL, "Multicast group was copied!");
> else if (TST_ERR == EADDRNOTAVAIL)
>
>
> --
> Cyril Hrubis
> chrubis@suse.cz
More information about the ltp
mailing list