netbsd-tests: libc: use correct modes in O_SEARCH tests

The current code clearly intended for these to be octal based on the values
used, but the octal prefix was forgotten. Add it now for correctness, but
note that we don't currently execute these tests.

This has been submitted upstream as misc/54902, so I've omitted the standard
FreeBSD markers that we tend to put into netbsd-tests for upstream-candidate
identification.

Reviewed by:	ngie
MFC after:	3 days
This commit is contained in:
Kyle Evans 2020-01-28 03:47:29 +00:00
parent cc3b01385b
commit 45c88a3cbb

View File

@ -79,7 +79,7 @@ ATF_TC_BODY(o_search_perm1, tc)
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
ATF_REQUIRE(fchmod(dfd, 644) == 0);
ATF_REQUIRE(fchmod(dfd, 0644) == 0);
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) == -1);
ATF_REQUIRE(errno == EACCES);
@ -109,12 +109,12 @@ ATF_TC_BODY(o_search_root_flag1, tc)
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
ATF_REQUIRE(fchmod(dfd, 644) == 0);
ATF_REQUIRE(fchmod(dfd, 0644) == 0);
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
ATF_REQUIRE(fchmod(dfd, 444) == 0);
ATF_REQUIRE(fchmod(dfd, 0444) == 0);
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
@ -141,12 +141,12 @@ ATF_TC_BODY(o_search_unpriv_flag1, tc)
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
ATF_REQUIRE(fchmod(dfd, 644) == 0);
ATF_REQUIRE(fchmod(dfd, 0644) == 0);
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
ATF_REQUIRE(close(fd) == 0);
ATF_REQUIRE(fchmod(dfd, 444) == 0);
ATF_REQUIRE(fchmod(dfd, 0444) == 0);
ATF_REQUIRE((fd = openat(dfd, BASEFILE, O_RDWR, 0)) != -1);
@ -173,7 +173,7 @@ ATF_TC_BODY(o_search_perm2, tc)
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
ATF_REQUIRE(fchmod(dfd, 644) == 0);
ATF_REQUIRE(fchmod(dfd, 0644) == 0);
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == -1);
ATF_REQUIRE(errno == EACCES);
@ -202,11 +202,11 @@ ATF_TC_BODY(o_search_root_flag2, tc)
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
ATF_REQUIRE(fchmod(dfd, 644) == 0);
ATF_REQUIRE(fchmod(dfd, 0644) == 0);
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
ATF_REQUIRE(fchmod(dfd, 444) == 0);
ATF_REQUIRE(fchmod(dfd, 0444) == 0);
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
@ -232,11 +232,11 @@ ATF_TC_BODY(o_search_unpriv_flag2, tc)
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
ATF_REQUIRE(fchmod(dfd, 644) == 0);
ATF_REQUIRE(fchmod(dfd, 0644) == 0);
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);
ATF_REQUIRE(fchmod(dfd, 444) == 0);
ATF_REQUIRE(fchmod(dfd, 0444) == 0);
ATF_REQUIRE(faccessat(dfd, BASEFILE, W_OK, 0) == 0);