git: 8109a5c0fba0 - main - contrib/netbsd-tests: lib/libc/c063: sync with NetBSD

Enji Cooper <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a856537.1d6c8.7cc296d3__26561.248109077$1787127165$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by ngie:

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

commit 8109a5c0fba0d015354a69b40e6682d5e8c0f638
Author:     Enji Cooper <[email protected]>
AuthorDate: 2026-08-19 07:57:27 +0000
Commit:     Enji Cooper <[email protected]>
CommitDate: 2026-08-19 08:10:20 +0000

    contrib/netbsd-tests: lib/libc/c063: sync with NetBSD
    
    This change syncs the lib/libc/c063 NetBSD tests with FreeBSD. This does
    two things:
    - Addresses bogus tautologically true assertions flagged by clang and gcc
      with ATF 0.22+ [1].
    - Brings in some new test coverage.
    
    Obtained from:  NetBSD (date tag: `20260818UTC`)
    MFC after:      2 weeks
    1. https://github.com/freebsd/atf/pull/72
---
 contrib/netbsd-tests/lib/libc/c063/t_faccessat.c |  73 ++++++++++-
 contrib/netbsd-tests/lib/libc/c063/t_fchmodat.c  |  17 ++-
 contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c  |  31 ++++-
 contrib/netbsd-tests/lib/libc/c063/t_utimensat.c | 148 ++++++++++++++---------
 4 files changed, 198 insertions(+), 71 deletions(-)

diff --git a/contrib/netbsd-tests/lib/libc/c063/t_faccessat.c b/contrib/netbsd-tests/lib/libc/c063/t_faccessat.c
index 5e6829f7ea45..7fb638db6b62 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_faccessat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_faccessat.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_faccessat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
+/*	$NetBSD: t_faccessat.c,v 1.5 2024/07/07 14:29:48 christos Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_faccessat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
+__RCSID("$NetBSD: t_faccessat.c,v 1.5 2024/07/07 14:29:48 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -72,7 +72,7 @@ ATF_TC(faccessat_fdcwd);
 ATF_TC_HEAD(faccessat_fdcwd, tc)
 {
 	atf_tc_set_md_var(tc, "descr", 
-			  "See that faccessat works with fd as AT_FDCWD");
+	    "See that faccessat works with fd as AT_FDCWD");
 }
 ATF_TC_BODY(faccessat_fdcwd, tc)
 {
@@ -90,7 +90,7 @@ ATF_TC(faccessat_fdcwderr);
 ATF_TC_HEAD(faccessat_fdcwderr, tc)
 {
 	atf_tc_set_md_var(tc, "descr", 
-		  "See that faccessat fails with fd as AT_FDCWD and bad path");
+	    "See that faccessat fails with fd as AT_FDCWD and bad path");
 }
 ATF_TC_BODY(faccessat_fdcwderr, tc)
 {
@@ -171,6 +171,68 @@ ATF_TC_BODY(faccessat_fdlink, tc)
 	ATF_REQUIRE(close(dfd) == 0);
 }
 
+ATF_TC(faccessat_abs);
+ATF_TC_HEAD(faccessat_abs, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "See that faccessat works with invalid "
+	    "fd when absolute path is provided.");
+}
+ATF_TC_BODY(faccessat_abs, tc)
+{
+	int fd;
+	char cwd[MAXPATHLEN];
+	char abs_path[MAXPATHLEN * 2];
+
+	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
+	ATF_REQUIRE((fd = open(FILE, O_CREAT|O_RDWR, 0644)) != -1);
+	ATF_REQUIRE(close(fd) == 0);
+
+	ATF_REQUIRE(getcwd(cwd, MAXPATHLEN));
+	snprintf(abs_path, sizeof(abs_path), "%s/%s", cwd, FILE);
+	ATF_REQUIRE(faccessat(-1, abs_path, W_OK, 0) == 0);
+
+}
+
+ATF_TC(faccessat_abs_fddir);
+ATF_TC_HEAD(faccessat_abs_fddir, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "See that faccessat works with "
+	    "fd of directory when absolute path is provided.");
+}
+ATF_TC_BODY(faccessat_abs_fddir, tc)
+{
+	int dfd;
+	char cwd[MAXPATHLEN];
+	char abs_path[MAXPATHLEN * 2];
+
+	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
+	ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1);
+	ATF_REQUIRE(close(dfd) == 0);
+
+	ATF_REQUIRE(getcwd(cwd, MAXPATHLEN));
+	snprintf(abs_path, sizeof(abs_path), "%s/%s", cwd, DIR);
+	ATF_REQUIRE(faccessat(dfd, abs_path, W_OK, 0) == 0);
+
+}
+
+ATF_TC(faccessat_abs_fdcwd);
+ATF_TC_HEAD(faccessat_abs_fdcwd, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "See that faccessat works with fd "
+	    "of current directory when absolute path is provided.");
+}
+ATF_TC_BODY(faccessat_abs_fdcwd, tc)
+{
+	char cwd[MAXPATHLEN];
+	char abs_path[MAXPATHLEN * 2];
+
+	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
+
+	ATF_REQUIRE(getcwd(cwd, MAXPATHLEN));
+	snprintf(abs_path, sizeof(abs_path), "%s/%s", cwd, DIR);
+	ATF_REQUIRE(faccessat(AT_FDCWD, abs_path, W_OK, 0) == 0);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -181,6 +243,9 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, faccessat_fderr2);
 	ATF_TP_ADD_TC(tp, faccessat_fderr3);
 	ATF_TP_ADD_TC(tp, faccessat_fdlink);
+	ATF_TP_ADD_TC(tp, faccessat_abs);
+	ATF_TP_ADD_TC(tp, faccessat_abs_fddir);
+	ATF_TP_ADD_TC(tp, faccessat_abs_fdcwd);
 
 	return atf_no_error();
 }
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_fchmodat.c b/contrib/netbsd-tests/lib/libc/c063/t_fchmodat.c
index a7bb6831b86c..4dd015542735 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_fchmodat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_fchmodat.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_fchmodat.c,v 1.3 2017/01/10 15:13:56 christos Exp $ */
+/*	$NetBSD: t_fchmodat.c,v 1.7 2024/07/10 20:44:06 rillig Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_fchmodat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
+__RCSID("$NetBSD: t_fchmodat.c,v 1.7 2024/07/10 20:44:06 rillig Exp $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -49,6 +49,11 @@ __RCSID("$NetBSD: t_fchmodat.c,v 1.3 2017/01/10 15:13:56 christos Exp $");
 #define BASELINK "symlink"
 #define FILEERR "dir/fchmodaterr"
 
+#define modecheck(a, b) \
+	ATF_REQUIRE_MSG(((a) & ALLPERMS) == (b), \
+	    "Incorrect mode found %#o != expected %#o", \
+	    ((a) & ALLPERMS), (b));
+
 ATF_TC(fchmodat_fd);
 ATF_TC_HEAD(fchmodat_fd, tc)
 {
@@ -69,7 +74,7 @@ ATF_TC_BODY(fchmodat_fd, tc)
 	ATF_REQUIRE(close(dfd) == 0);
 
 	ATF_REQUIRE(stat(FILE, &st) == 0);
-	ATF_REQUIRE(st.st_mode = 0600);
+	modecheck(st.st_mode, 0600);
 }
 
 ATF_TC(fchmodat_fdcwd);
@@ -91,7 +96,7 @@ ATF_TC_BODY(fchmodat_fdcwd, tc)
 	ATF_REQUIRE(fchmodat(AT_FDCWD, BASEFILE, 0600, 0) == 0);
 
 	ATF_REQUIRE(stat(BASEFILE, &st) == 0);
-	ATF_REQUIRE(st.st_mode = 0600);
+	modecheck(st.st_mode, 0600);
 }
 
 ATF_TC(fchmodat_fdcwderr);
@@ -173,14 +178,14 @@ ATF_TC_BODY(fchmodat_fdlink, tc)
 	ATF_REQUIRE((dfdlink = open(DIR, O_RDONLY, 0)) != -1);
 
 	ATF_REQUIRE(fchmodat(dfdlink, BASELINK, 0600, 0) == -1);
-	ATF_REQUIRE(errno = ENOENT);
+	ATF_REQUIRE(errno == ENOENT);
 
 	ATF_REQUIRE(fchmodat(dfdlink, BASELINK, 0600, AT_SYMLINK_NOFOLLOW) == 0);
 
 	ATF_REQUIRE(close(dfdlink) == 0);
 
 	ATF_REQUIRE(lstat(LINK, &st) == 0);
-	ATF_REQUIRE(st.st_mode = 0600);
+	modecheck(st.st_mode, 0600);
 }
 
 ATF_TP_ADD_TCS(tp)
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c b/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c
index 4f91afd979a7..3f6c17d5e141 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_mkfifoat.c,v 1.4 2017/01/14 20:55:26 christos Exp $ */
+/*	$NetBSD: t_mkfifoat.c,v 1.5 2019/06/20 03:31:53 kamil Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mkfifoat.c,v 1.4 2017/01/14 20:55:26 christos Exp $");
+__RCSID("$NetBSD: t_mkfifoat.c,v 1.5 2019/06/20 03:31:53 kamil Exp $");
 
 #include <atf-c.h>
 #include <errno.h>
@@ -108,6 +108,32 @@ ATF_TC_BODY(mkfifoat_fderr, tc)
 	ATF_REQUIRE(mkfifoat(-1, FIFO, mode) == -1);
 }
 
+ATF_TC(mknodat_s_ififo);
+ATF_TC_HEAD(mknodat_s_ififo, tc)
+{
+	atf_tc_set_md_var(tc, "descr", "Test mknodat(2) with S_IFIFO");
+}
+
+ATF_TC_BODY(mknodat_s_ififo, tc)
+{
+	struct stat st;
+	int dfd;
+	mode_t mode = S_IFIFO | 0600;
+
+	(void)memset(&st, 0, sizeof(struct stat));
+
+	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
+	ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1);
+	ATF_REQUIRE(mknodat(dfd, BASEFIFO, mode, 0) != -1);
+	ATF_REQUIRE(access(FIFO, F_OK) == 0);
+	ATF_REQUIRE(stat(FIFO, &st) == 0);
+
+	if (S_ISFIFO(st.st_mode) == 0)
+		atf_tc_fail("invalid mode from mknodat(2) with S_IFIFO");
+
+	(void)close(dfd);
+}
+
 ATF_TP_ADD_TCS(tp)
 {
 
@@ -115,6 +141,7 @@ ATF_TP_ADD_TCS(tp)
 	ATF_TP_ADD_TC(tp, mkfifoat_fdcwd);
 	ATF_TP_ADD_TC(tp, mkfifoat_fdcwderr);
 	ATF_TP_ADD_TC(tp, mkfifoat_fderr);
+	ATF_TP_ADD_TC(tp, mknodat_s_ififo);
 
 	return atf_no_error();
 }
diff --git a/contrib/netbsd-tests/lib/libc/c063/t_utimensat.c b/contrib/netbsd-tests/lib/libc/c063/t_utimensat.c
index 682c2df06974..8534647b0e32 100644
--- a/contrib/netbsd-tests/lib/libc/c063/t_utimensat.c
+++ b/contrib/netbsd-tests/lib/libc/c063/t_utimensat.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_utimensat.c,v 1.6 2017/01/10 15:13:56 christos Exp $ */
+/*	$NetBSD: t_utimensat.c,v 1.9 2024/08/10 15:20:22 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,11 +29,14 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_utimensat.c,v 1.6 2017/01/10 15:13:56 christos Exp $");
+__RCSID("$NetBSD: t_utimensat.c,v 1.9 2024/08/10 15:20:22 riastradh Exp $");
 
 #include <sys/param.h>
+
 #include <sys/stat.h>
+#include <sys/statvfs.h>
 #include <sys/time.h>
+
 #include <atf-c.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -43,6 +46,8 @@ __RCSID("$NetBSD: t_utimensat.c,v 1.6 2017/01/10 15:13:56 christos Exp $");
 #include <string.h>
 #include <unistd.h>
 
+#include "h_macros.h"
+
 #define DIR "dir"
 #define FILE "dir/utimensat"
 #define BASEFILE "utimensat"
@@ -50,11 +55,37 @@ __RCSID("$NetBSD: t_utimensat.c,v 1.6 2017/01/10 15:13:56 christos Exp $");
 #define BASELINK "symlink"
 #define FILEERR "dir/symlink"
 
-const struct timespec tptr[] = { 
+static const struct timespec tptr[] = {
 	{ 0x12345678, 987654321 },
 	{ 0x15263748, 123456789 },
 };
 
+static void
+checkstattime(const struct stat *st, const struct statvfs *fs)
+{
+
+/* Begin FreeBSD: upstream conditional. */
+#ifdef	ST_NOATIME
+	if ((fs->f_flag & ST_NOATIME) == 0) {
+		ATF_CHECK_EQ_MSG(st->st_atimespec.tv_sec, tptr[0].tv_sec,
+		    "st->st_atimespec.tv_sec=%lld tptr[0].tv_sec=%lld",
+		    (long long)st->st_atimespec.tv_sec,
+		    (long long)tptr[0].tv_sec);
+		ATF_CHECK_EQ_MSG(st->st_atimespec.tv_nsec, tptr[0].tv_nsec,
+		    "st->st_atimespec.tv_nsec=%ld tptr[0].tv_nsec=%ld",
+		    (long)st->st_atimespec.tv_nsec, (long)tptr[0].tv_nsec);
+	}
+#endif
+/* End FreeBSD */
+
+	ATF_CHECK_EQ_MSG(st->st_mtimespec.tv_sec, tptr[1].tv_sec,
+	    "st->st_mtimespec.tv_sec=%lld tptr[1].tv_sec=%lld",
+	    (long long)st->st_mtimespec.tv_sec, (long long)tptr[1].tv_sec);
+	ATF_CHECK_EQ_MSG(st->st_mtimespec.tv_nsec, tptr[1].tv_nsec,
+	    "st->st_mtimespec.tv_nsec=%ld tptr[1].tv_nsec=%ld",
+	    (long)st->st_mtimespec.tv_nsec, (long)tptr[1].tv_nsec);
+}
+
 ATF_TC(utimensat_fd);
 ATF_TC_HEAD(utimensat_fd, tc)
 {
@@ -65,78 +96,78 @@ ATF_TC_BODY(utimensat_fd, tc)
 	int dfd;
 	int fd;
 	struct stat st;
+	struct statvfs fs;
 
-	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
-	ATF_REQUIRE((fd = open(FILE, O_CREAT|O_RDWR, 0644)) != -1);
-	ATF_REQUIRE(close(fd) == 0);
+	RL(mkdir(DIR, 0755));
+	RL(fd = open(FILE, O_CREAT|O_RDWR, 0644));
+	RL(close(fd));
 
-	ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1);
-	ATF_REQUIRE(utimensat(dfd, BASEFILE, tptr, 0) == 0);
-	ATF_REQUIRE(close(dfd) == 0);
+	RL(dfd = open(DIR, O_RDONLY, 0));
+	RL(utimensat(dfd, BASEFILE, tptr, 0));
+	RL(close(dfd));
 
-	ATF_REQUIRE(stat(FILE, &st) == 0);
-	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[0].tv_sec);
-	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[0].tv_nsec);
-	ATF_REQUIRE(st.st_mtimespec.tv_sec == tptr[1].tv_sec);
-	ATF_REQUIRE(st.st_mtimespec.tv_nsec == tptr[1].tv_nsec);
+	RL(stat(FILE, &st));
+	RL(statvfs(FILE, &fs));
+	checkstattime(&st, &fs);
 }
 
 ATF_TC(utimensat_fdcwd);
 ATF_TC_HEAD(utimensat_fdcwd, tc)
 {
-	atf_tc_set_md_var(tc, "descr", 
-			  "See that utimensat works with fd as AT_FDCWD");
+	atf_tc_set_md_var(tc, "descr",
+	    "See that utimensat works with fd as AT_FDCWD");
 }
 ATF_TC_BODY(utimensat_fdcwd, tc)
 {
 	int fd;
 	struct stat st;
+	struct statvfs fs;
 
-	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
-	ATF_REQUIRE((fd = open(FILE, O_CREAT|O_RDWR, 0644)) != -1);
-	ATF_REQUIRE(close(fd) == 0);
+	RL(mkdir(DIR, 0755));
+	RL(fd = open(FILE, O_CREAT|O_RDWR, 0644));
+	RL(close(fd));
 
-	ATF_REQUIRE(chdir(DIR) == 0);
-	ATF_REQUIRE(utimensat(AT_FDCWD, BASEFILE, tptr, 0) == 0);
+	RL(chdir(DIR));
+	RL(utimensat(AT_FDCWD, BASEFILE, tptr, 0));
 
-	ATF_REQUIRE(stat(BASEFILE, &st) == 0);
-	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[0].tv_sec);
-	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[0].tv_nsec);
-	ATF_REQUIRE(st.st_mtimespec.tv_sec == tptr[1].tv_sec);
-	ATF_REQUIRE(st.st_mtimespec.tv_nsec == tptr[1].tv_nsec);
+	RL(stat(BASEFILE, &st));
+	RL(statvfs(BASEFILE, &fs));
+	checkstattime(&st, &fs);
 }
 
 ATF_TC(utimensat_fdcwderr);
 ATF_TC_HEAD(utimensat_fdcwderr, tc)
 {
-	atf_tc_set_md_var(tc, "descr", 
-		  "See that utimensat fails with fd as AT_FDCWD and bad path");
+	atf_tc_set_md_var(tc, "descr",
+	    "See that utimensat fails with fd as AT_FDCWD and bad path");
 }
 ATF_TC_BODY(utimensat_fdcwderr, tc)
 {
-	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
-	ATF_REQUIRE(utimensat(AT_FDCWD, FILEERR, tptr, 0) == -1);
+	RL(mkdir(DIR, 0755));
+	ATF_CHECK_ERRNO(ENOENT, utimensat(AT_FDCWD, FILEERR, tptr, 0) == -1);
 }
 
 ATF_TC(utimensat_fderr1);
 ATF_TC_HEAD(utimensat_fderr1, tc)
 {
-	atf_tc_set_md_var(tc, "descr", "See that utimensat fail with bad path");
+	atf_tc_set_md_var(tc, "descr",
+	    "See that utimensat fail with bad path");
 }
 ATF_TC_BODY(utimensat_fderr1, tc)
 {
 	int dfd;
 
-	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
-	ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1);
-	ATF_REQUIRE(utimensat(dfd, FILEERR, tptr, 0) == -1);
-	ATF_REQUIRE(close(dfd) == 0);
+	RL(mkdir(DIR, 0755));
+	RL(dfd = open(DIR, O_RDONLY, 0));
+	ATF_CHECK_ERRNO(ENOENT, utimensat(dfd, FILEERR, tptr, 0) == -1);
+	RL(close(dfd));
 }
 
 ATF_TC(utimensat_fderr2);
 ATF_TC_HEAD(utimensat_fderr2, tc)
 {
-	atf_tc_set_md_var(tc, "descr", "See that utimensat fails with bad fdat");
+	atf_tc_set_md_var(tc, "descr",
+	    "See that utimensat fails with bad fdat");
 }
 ATF_TC_BODY(utimensat_fderr2, tc)
 {
@@ -144,29 +175,30 @@ ATF_TC_BODY(utimensat_fderr2, tc)
 	int fd;
 	char cwd[MAXPATHLEN];
 
-	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
-	ATF_REQUIRE((fd = open(FILE, O_CREAT|O_RDWR, 0644)) != -1);
-	ATF_REQUIRE(close(fd) == 0);
+	RL(mkdir(DIR, 0755));
+	RL(fd = open(FILE, O_CREAT|O_RDWR, 0644));
+	RL(close(fd));
 
-	ATF_REQUIRE((dfd = open(getcwd(cwd, MAXPATHLEN), O_RDONLY, 0)) != -1);
-	ATF_REQUIRE(utimensat(dfd, BASEFILE, tptr, 0) == -1);
-	ATF_REQUIRE(close(dfd) == 0);
+	RL(dfd = open(getcwd(cwd, MAXPATHLEN), O_RDONLY, 0));
+	ATF_CHECK_ERRNO(ENOENT, utimensat(dfd, BASEFILE, tptr, 0) == -1);
+	RL(close(dfd));
 }
 
 ATF_TC(utimensat_fderr3);
 ATF_TC_HEAD(utimensat_fderr3, tc)
 {
-	atf_tc_set_md_var(tc, "descr", "See that utimensat fails with fd as -1");
+	atf_tc_set_md_var(tc, "descr",
+	    "See that utimensat fails with fd as -1");
 }
 ATF_TC_BODY(utimensat_fderr3, tc)
 {
 	int fd;
 
-	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
-	ATF_REQUIRE((fd = open(FILE, O_CREAT|O_RDWR, 0644)) != -1);
-	ATF_REQUIRE(close(fd) == 0);
+	RL(mkdir(DIR, 0755));
+	RL(fd = open(FILE, O_CREAT|O_RDWR, 0644));
+	RL(close(fd));
 
-	ATF_REQUIRE(utimensat(-1, FILE, tptr, 0) == -1);
+	ATF_CHECK_ERRNO(EBADF, utimensat(-1, FILE, tptr, 0) == -1);
 }
 
 ATF_TC(utimensat_fdlink);
@@ -178,24 +210,22 @@ ATF_TC_BODY(utimensat_fdlink, tc)
 {
 	int dfd;
 	struct stat st;
+	struct statvfs fs;
 
-	ATF_REQUIRE(mkdir(DIR, 0755) == 0);
-	ATF_REQUIRE(symlink(FILE, LINK) == 0); /* NB: FILE does not exists */
+	RL(mkdir(DIR, 0755));
+	RL(symlink(FILE, LINK)); /* NB: FILE does not exists */
 
-	ATF_REQUIRE((dfd = open(DIR, O_RDONLY, 0)) != -1);
+	RL(dfd = open(DIR, O_RDONLY, 0));
 
-	ATF_REQUIRE(utimensat(dfd, BASELINK, tptr, 0) == -1);
-	ATF_REQUIRE(errno = ENOENT);
+	ATF_CHECK_ERRNO(ENOENT, utimensat(dfd, BASELINK, tptr, 0) == -1);
 
-	ATF_REQUIRE(utimensat(dfd, BASELINK, tptr, AT_SYMLINK_NOFOLLOW) == 0);
+	RL(utimensat(dfd, BASELINK, tptr, AT_SYMLINK_NOFOLLOW));
 
-	ATF_REQUIRE(close(dfd) == 0);
+	RL(close(dfd));
 
-	ATF_REQUIRE(lstat(LINK, &st) == 0);
-	ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[0].tv_sec);
-	ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[0].tv_nsec);
-	ATF_REQUIRE(st.st_mtimespec.tv_sec == tptr[1].tv_sec);
-	ATF_REQUIRE(st.st_mtimespec.tv_nsec == tptr[1].tv_nsec);
+	RL(lstat(LINK, &st));
+	RL(statvfs(DIR, &fs));	/* XXX should do lstatvfs(LINK, &fs) */
+	checkstattime(&st, &fs);
 }
 
 ATF_TP_ADD_TCS(tp)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.