tests: fix posix_spawnp_enoexec_fallback_null_argv0

This test was written because execvp was found to improperly handle the
argc == 0 case when it falls back from an ENOEXEC.  We could probably
mostly revert it now, but let's just fix the test for the time being and
circle back later to decide if we want to simplify execvp.  The test
will likely remain either way just to make sure execvp isn't working
around the newly enforced restriction with the fallback.

Fixes:	301cb491ea ("execvp: fix up the ENOEXEC fallback")
Reported by:	jenkins via lwhsu@
This commit is contained in:
Kyle Evans 2022-01-27 11:22:49 -06:00
parent 21c966a6b9
commit c9afc7680f

View File

@ -117,17 +117,14 @@ ATF_TC_BODY(posix_spawnp_enoexec_fallback_null_argv0, tc)
{
char buf[FILENAME_MAX];
char *myargs[1];
int error, status;
pid_t pid, waitres;
int error;
pid_t pid;
snprintf(buf, sizeof(buf), "%s/spawnp_enoexec.sh",
atf_tc_get_config_var(tc, "srcdir"));
myargs[0] = NULL;
error = posix_spawnp(&pid, buf, NULL, NULL, myargs, myenv);
ATF_REQUIRE(error == 0);
waitres = waitpid(pid, &status, 0);
ATF_REQUIRE(waitres == pid);
ATF_REQUIRE(WIFEXITED(status) && WEXITSTATUS(status) == 42);
ATF_REQUIRE(error == EINVAL);
}
ATF_TP_ADD_TCS(tp)