Skip to contentSkip to conversation

accept02: Add SAFE_FORK to clean CLOSE_WAIT fds

PATCH zhaogongyi via ltp 1 participant 1 message Mar 24, 2022

lore
Share & tools
lore
#0 lore raw

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/[email protected]/

Best regards,

Gongyi

Quoted 25 lines

Hi!
As far as I can tell we should rather close the fd returned from the accept() call like this:

testcases/kernel/syscalls/accept/accept02.c +2 -0
index 12a1e3ca3..b2d27a260 100644
@@ -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
[email protected]

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp