git: c9afc7680f3e - main - tests: fix posix_spawnp_enoexec_fallback_null_argv0

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Thu, 27 Jan 2022 17:23:20 UTC
The branch main has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=c9afc7680f3e1f0510518de9de4264553a31aade

commit c9afc7680f3e1f0510518de9de4264553a31aade
Author:     Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2022-01-27 17:22:49 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2022-01-27 17:22:49 +0000

    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:  301cb491ea41 ("execvp: fix up the ENOEXEC fallback")
    Reported by:    jenkins via lwhsu@
---
 lib/libc/tests/gen/posix_spawn_test.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/lib/libc/tests/gen/posix_spawn_test.c b/lib/libc/tests/gen/posix_spawn_test.c
index 5e2c485473d0..46259cbf8cde 100644
--- a/lib/libc/tests/gen/posix_spawn_test.c
+++ b/lib/libc/tests/gen/posix_spawn_test.c
@@ -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)