Date: Mon, 20 Mar 2017 08:58:22 +0000 (UTC) From: Peter Holm <pho@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r315628 - user/pho/stress2/testcases/tcp Message-ID: <201703200858.v2K8wM0w021361@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pho Date: Mon Mar 20 08:58:22 2017 New Revision: 315628 URL: https://svnweb.freebsd.org/changeset/base/315628 Log: Added missing waitpid() and cleanup code while here. Sponsored by: Dell EMC Isilon Modified: user/pho/stress2/testcases/tcp/tcp.c Modified: user/pho/stress2/testcases/tcp/tcp.c ============================================================================== --- user/pho/stress2/testcases/tcp/tcp.c Mon Mar 20 08:57:25 2017 (r315627) +++ user/pho/stress2/testcases/tcp/tcp.c Mon Mar 20 08:58:22 2017 (r315628) @@ -30,7 +30,10 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/socket.h> +#include <sys/wait.h> + #include <netinet/in.h> + #include <err.h> #include <errno.h> #include <netdb.h> @@ -143,8 +146,10 @@ writer(void) { if (write(tcpsock, buf, bufsize) < 0) { if (errno == EPIPE) return; - err(1, "write(%d), %s:%d", tcpsock, + if (errno != ECONNRESET) + err(1, "write(%d), %s:%d", tcpsock, __FILE__, __LINE__); + _exit(EXIT_SUCCESS); } } } @@ -171,11 +176,13 @@ test(void) if ((pid = fork()) == 0) { writer(); - exit(EXIT_SUCCESS); + _exit(EXIT_SUCCESS); } else if (pid > 0) { reader(); kill(pid, SIGINT); + if (waitpid(pid, NULL, 0) != pid) + err(1, "waitpid(%d)", pid); } else err(1, "fork(), %s:%d", __FILE__, __LINE__);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703200858.v2K8wM0w021361>