diff options
author | ngie <ngie@FreeBSD.org> | 2014-10-23 07:54:46 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2014-10-23 07:54:46 +0000 |
commit | ef8a3be81f0fd1cd987802e5a11cf7f20854f616 (patch) | |
tree | dcc0eda7604f657acfc7de0be3a4a76a02b2fd15 /contrib/netbsd-tests/lib/libc/sys/t_truncate.c | |
parent | ef3a237704209418b3d573487fceac353a64a434 (diff) | |
download | FreeBSD-src-ef8a3be81f0fd1cd987802e5a11cf7f20854f616.zip FreeBSD-src-ef8a3be81f0fd1cd987802e5a11cf7f20854f616.tar.gz |
Use <atf_srcdir>/truncate_test.root_owned instead of /usr/bin/fpr as fpr does
not exist on FreeBSD
truncate_test.root_owned will be generated at build time and owned by root
In collaboration with: pho
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'contrib/netbsd-tests/lib/libc/sys/t_truncate.c')
-rw-r--r-- | contrib/netbsd-tests/lib/libc/sys/t_truncate.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/lib/libc/sys/t_truncate.c b/contrib/netbsd-tests/lib/libc/sys/t_truncate.c index 50a9cba..59193a9 100644 --- a/contrib/netbsd-tests/lib/libc/sys/t_truncate.c +++ b/contrib/netbsd-tests/lib/libc/sys/t_truncate.c @@ -40,6 +40,10 @@ __RCSID("$NetBSD: t_truncate.c,v 1.2 2011/08/18 19:48:03 dholland Exp $"); #include <string.h> #include <unistd.h> +#ifdef __FreeBSD__ +#include <limits.h> +#endif + static const char path[] = "truncate"; static const size_t sizes[] = { 8, 16, 512, 1024, 2048, 4094, 3000, 30 }; @@ -149,6 +153,9 @@ ATF_TC_HEAD(truncate_err, tc) ATF_TC_BODY(truncate_err, tc) { +#ifndef __NetBSD__ + char buf[PATH_MAX]; +#endif errno = 0; ATF_REQUIRE_ERRNO(EFAULT, truncate((void *)-1, 999) == -1); @@ -160,7 +167,13 @@ ATF_TC_BODY(truncate_err, tc) ATF_REQUIRE_ERRNO(ENOENT, truncate("/a/b/c/d/e/f/g", 999) == -1); errno = 0; +#ifdef __NetBSD__ ATF_REQUIRE_ERRNO(EACCES, truncate("/usr/bin/fpr", 999) == -1); +#else + snprintf(buf, sizeof(buf), "%s/truncate_test.root_owned", + atf_tc_get_config_var(tc, "srcdir")); + ATF_REQUIRE_ERRNO(EACCES, truncate(buf, 999) == -1); +#endif } ATF_TP_ADD_TCS(tp) |