From 13981c9510e55caba04d5e33fdd8ad5a060a7249 Mon Sep 17 00:00:00 2001 From: martin Date: Thu, 22 Nov 2012 14:51:19 +0000 Subject: [PATCH] Fix off by one in static array acces, use valid timestamps (ns part < 1e9), just in case a filesystem would need to convert this to some other representation. --- tests/lib/libc/c063/t_utimensat.c | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/lib/libc/c063/t_utimensat.c b/tests/lib/libc/c063/t_utimensat.c index b658f58f2596..e56082b2a344 100644 --- a/tests/lib/libc/c063/t_utimensat.c +++ b/tests/lib/libc/c063/t_utimensat.c @@ -1,4 +1,4 @@ -/* $NetBSD: t_utimensat.c,v 1.2 2012/11/19 16:07:56 martin Exp $ */ +/* $NetBSD: t_utimensat.c,v 1.3 2012/11/22 14:51:19 martin Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: t_utimensat.c,v 1.2 2012/11/19 16:07:56 martin Exp $"); +__RCSID("$NetBSD: t_utimensat.c,v 1.3 2012/11/22 14:51:19 martin Exp $"); #include #include @@ -50,8 +50,8 @@ __RCSID("$NetBSD: t_utimensat.c,v 1.2 2012/11/19 16:07:56 martin Exp $"); #define FILEERR "dir/symlink" const struct timespec tptr[] = { - { 0x12345678, 0x87654321 }, - { 0x15263748, 0x84736251 }, + { 0x12345678, 987654321 }, + { 0x15263748, 123456789 }, }; ATF_TC_WITH_CLEANUP(utimensat_fd); @@ -75,10 +75,10 @@ ATF_TC_BODY(utimensat_fd, tc) ATF_REQUIRE(close(dfd) == 0); ATF_REQUIRE(stat(FILE, &st) == 0); - ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[1].tv_sec); - ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[1].tv_nsec); - ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[2].tv_sec); - ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[2].tv_nsec); + 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_ctimespec.tv_sec == tptr[1].tv_sec); + ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[1].tv_nsec); } ATF_TC_CLEANUP(utimensat_fd, tc) @@ -108,10 +108,10 @@ ATF_TC_BODY(utimensat_fdcwd, tc) ATF_REQUIRE(utimensat(AT_FDCWD, BASEFILE, tptr, 0) == 0); ATF_REQUIRE(stat(BASEFILE, &st) == 0); - ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[1].tv_sec); - ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[1].tv_nsec); - ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[2].tv_sec); - ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[2].tv_nsec); + 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_ctimespec.tv_sec == tptr[1].tv_sec); + ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[1].tv_nsec); } ATF_TC_CLEANUP(utimensat_fdcwd, tc) @@ -240,10 +240,10 @@ ATF_TC_BODY(utimensat_fdlink, tc) ATF_REQUIRE(close(dfd) == 0); ATF_REQUIRE(lstat(LINK, &st) == 0); - ATF_REQUIRE(st.st_atimespec.tv_sec == tptr[1].tv_sec); - ATF_REQUIRE(st.st_atimespec.tv_nsec == tptr[1].tv_nsec); - ATF_REQUIRE(st.st_ctimespec.tv_sec == tptr[2].tv_sec); - ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[2].tv_nsec); + 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_ctimespec.tv_sec == tptr[1].tv_sec); + ATF_REQUIRE(st.st_ctimespec.tv_nsec == tptr[1].tv_nsec); } ATF_TC_CLEANUP(utimensat_fdlink, tc)