diff --git a/tests/fork_func/check.h b/tests/fork_func/check.h index 1cc16bcf..ac8df5d3 100644 --- a/tests/fork_func/check.h +++ b/tests/fork_func/check.h @@ -9,7 +9,7 @@ int check_exit(void); /** * check_exec(void): - * Check that fork_func() works with exec(). + * Check that fork_func() works with an exec* function. */ int check_exec(void); diff --git a/tests/fork_func/check_exec.c b/tests/fork_func/check_exec.c index c7ab07db..037d387a 100644 --- a/tests/fork_func/check_exec.c +++ b/tests/fork_func/check_exec.c @@ -11,6 +11,7 @@ func_exec(void * cookie) (void)cookie; /* UNUSED */ + /* Execute the "true" binary found in the $PATH. */ if (execlp("true", "true", NULL)) warnp("execvp"); @@ -20,14 +21,19 @@ func_exec(void * cookie) /** * check_exec(void): - * Check that fork_func() works with exec(). + * Check that fork_func() works with an exec* function. */ int check_exec(void) { + pid_t pid; /* Fork. */ - if (fork_func(func_exec, NULL) == -1) + if ((pid = fork_func(func_exec, NULL) == -1)) + goto err0; + + /* Check that it didn't fail. */ + if (fork_func_wait(pid) != 0) goto err0; /* Success! */