From 1551444228d7e0a0b0e1028dabd23d92fb8f2834 Mon Sep 17 00:00:00 2001 From: Anoop C S Date: Wed, 27 Jun 2018 23:35:28 +0530 Subject: tests: Prevent child process falling to defunct state Parent process does not wait for child process(which gets forked after accepting a client connection) to exit inside echo server which in turn puts child into defunct state. Even though those defunct childs are cleaned up during parent exit it is better to wait from parent process itself. Signed-off-by: Anoop C S Reviewed-by: Andreas Schneider Reviewed-by: Stefan Metzmacher --- tests/echo_srv.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests') diff --git a/tests/echo_srv.c b/tests/echo_srv.c index 771904a..3f8b2a9 100644 --- a/tests/echo_srv.c +++ b/tests/echo_srv.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -535,6 +536,7 @@ static void echo_tcp(int sock) close(s); exit(0); } + waitpid(-1, NULL, 0); close(s); } -- cgit