Date: Tue, 14 Jan 2025 08:57:16 GMT From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 1b2bf32658e5 - stable/14 - path_test: adjust test for open(O_PATH | O_CREAT) Message-ID: <202501140857.50E8vGgt058943@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=1b2bf32658e5a0dfb572e256370cb772255d2ad5 commit 1b2bf32658e5a0dfb572e256370cb772255d2ad5 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2025-01-06 22:07:07 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2025-01-14 08:56:41 +0000 path_test: adjust test for open(O_PATH | O_CREAT) (cherry picked from commit 749b3b2c0629f44f6b0044992dfb2ce5ac7e562b) --- tests/sys/file/path_test.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/sys/file/path_test.c b/tests/sys/file/path_test.c index 911c7c7075f0..b3b8b7cebd4d 100644 --- a/tests/sys/file/path_test.c +++ b/tests/sys/file/path_test.c @@ -684,10 +684,14 @@ ATF_TC_BODY(path_io, tc) size_t page_size; int error, fd, pathfd, sd[2]; - /* It shouldn't be possible to create new files with O_PATH. */ + /* It is allowed to create new files with O_PATH. */ snprintf(path, sizeof(path), "path_io.XXXXXX"); ATF_REQUIRE_MSG(mktemp(path) == path, FMT_ERR("mktemp")); - ATF_REQUIRE_ERRNO(ENOENT, open(path, O_PATH | O_CREAT, 0600) < 0); + pathfd = open(path, O_PATH | O_CREAT, 0600); + ATF_REQUIRE_MSG(pathfd >= 0, FMT_ERR("open(O_PATH|O_CREAT)")); + /* Ensure that this is indeed O_PATH fd */ + ATF_REQUIRE_ERRNO(EBADF, write(pathfd, path, strlen(path)) == -1); + CHECKED_CLOSE(pathfd); /* Create a non-empty file for use in the rest of the tests. */ mktfile(path, "path_io.XXXXXX");
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501140857.50E8vGgt058943>