summaryrefslogtreecommitdiffhomepage
path: root/src/tests/qemu/init.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2016-12-02 11:59:35 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2016-12-04 03:36:19 +0100
commita85f4b7349e2ce2aadc2546609578289aa886676 (patch)
tree450d883d8d05b8aa2c78cf911d3286d4311eff65 /src/tests/qemu/init.c
parent73a09df16fa6e7f303777dd5a55f3b0decc59c78 (diff)
tests: make sure ncat gets killed
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/tests/qemu/init.c')
-rw-r--r--src/tests/qemu/init.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/tests/qemu/init.c b/src/tests/qemu/init.c
index 62157c0..d23ec37 100644
--- a/src/tests/qemu/init.c
+++ b/src/tests/qemu/init.c
@@ -144,18 +144,17 @@ static void kmod_selftests(void)
static void launch_tests(void)
{
int status, fd;
+ pid_t pid;
pretty_message("[+] Launching tests...");
- switch (fork()) {
- case -1:
+ pid = fork();
+ if (pid == -1)
panic("fork");
- break;
- case 0:
+ else if (pid == 0) {
execl("/init.sh", "init", NULL);
panic("exec");
- break;
}
- if (wait(&status) < 0)
- panic("wait");
+ if (waitpid(pid, &status, 0) < 0)
+ panic("waitpid");
if (WIFEXITED(status) && WEXITSTATUS(status) == 0) {
pretty_message("[+] Tests successful! :-)");
fd = open("/dev/vport1p1", O_WRONLY);