summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAnoop C S <anoopcs@redhat.com>2018-06-27 23:35:28 +0530
committerAndreas Schneider <asn@samba.org>2018-08-09 10:59:23 +0200
commit1551444228d7e0a0b0e1028dabd23d92fb8f2834 (patch)
tree40da2c7abb06034caa90843db8ab6fe705d9395b /tests
parent326ae3b98f766b95ccc83717896acb8651ec2ab2 (diff)
downloadsocket_wrapper-1551444228d7e0a0b0e1028dabd23d92fb8f2834.tar.gz
socket_wrapper-1551444228d7e0a0b0e1028dabd23d92fb8f2834.tar.xz
socket_wrapper-1551444228d7e0a0b0e1028dabd23d92fb8f2834.zip
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 <anoopcs@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/echo_srv.c2
1 files changed, 2 insertions, 0 deletions
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 <sys/types.h>
#include <sys/socket.h>
#include <sys/stat.h>
+#include <sys/wait.h>
#include <arpa/inet.h>
#include <netinet/in.h>
@@ -535,6 +536,7 @@ static void echo_tcp(int sock)
close(s);
exit(0);
}
+ waitpid(-1, NULL, 0);
close(s);
}