Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/lib/libc/sys PR/51844: Ngie Cooper: use root-owned fil...
details: https://anonhg.NetBSD.org/src/rev/a5c2029989fb
branches: trunk
changeset: 820693:a5c2029989fb
user: christos <christos%NetBSD.org@localhost>
date: Fri Jan 13 20:03:51 2017 +0000
description:
PR/51844: Ngie Cooper: use root-owned file created during build instead of
/usr/bin/fpr
diffstat:
tests/lib/libc/sys/Makefile | 12 +++++++++++-
tests/lib/libc/sys/t_truncate.c | 10 +++++++---
2 files changed, 18 insertions(+), 4 deletions(-)
diffs (70 lines):
diff -r 448ea43bdb95 -r a5c2029989fb tests/lib/libc/sys/Makefile
--- a/tests/lib/libc/sys/Makefile Fri Jan 13 19:53:10 2017 +0000
+++ b/tests/lib/libc/sys/Makefile Fri Jan 13 20:03:51 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.45 2016/11/11 15:30:44 njoly Exp $
+# $NetBSD: Makefile,v 1.46 2017/01/13 20:03:51 christos Exp $
MKMAN= no
@@ -84,6 +84,16 @@
CPPFLAGS.t_lwp_create.c += -D_KERNTYPES
+FILES= truncate_test.root_owned
+FILESDIR= ${TESTSDIR}
+FILESMODE= 0600
+FILESOWNER= root
+FILESGRP= wheel
+
+CLEANFILES= truncate_test.root_owned
+truncate_test.root_owned:
+ dd if=/dev/null bs=1 count=1 of=${.TARGET}
+
WARNS= 4
.include <bsd.test.mk>
diff -r 448ea43bdb95 -r a5c2029989fb tests/lib/libc/sys/t_truncate.c
--- a/tests/lib/libc/sys/t_truncate.c Fri Jan 13 19:53:10 2017 +0000
+++ b/tests/lib/libc/sys/t_truncate.c Fri Jan 13 20:03:51 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_truncate.c,v 1.2 2011/08/18 19:48:03 dholland Exp $ */
+/* $NetBSD: t_truncate.c,v 1.3 2017/01/13 20:03:51 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,13 +29,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_truncate.c,v 1.2 2011/08/18 19:48:03 dholland Exp $");
+__RCSID("$NetBSD: t_truncate.c,v 1.3 2017/01/13 20:03:51 christos Exp $");
#include <sys/stat.h>
#include <atf-c.h>
#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -149,6 +150,7 @@
ATF_TC_BODY(truncate_err, tc)
{
+ char buf[PATH_MAX];
errno = 0;
ATF_REQUIRE_ERRNO(EFAULT, truncate((void *)-1, 999) == -1);
@@ -160,7 +162,9 @@
ATF_REQUIRE_ERRNO(ENOENT, truncate("/a/b/c/d/e/f/g", 999) == -1);
errno = 0;
- ATF_REQUIRE_ERRNO(EACCES, truncate("/usr/bin/fpr", 999) == -1);
+ snprintf(buf, sizeof(buf), "%s/truncate_test.root_owned",
+ atf_tc_get_config_var(tc, "srcdir"));
+ ATF_REQUIRE_ERRNO(EACCES, truncate(buf, 999) == -1);
}
ATF_TP_ADD_TCS(tp)
Home |
Main Index |
Thread Index |
Old Index