summaryrefslogtreecommitdiff
path: root/regress/lib/libc/sys/t_truncate.c
diff options
context:
space:
mode:
authorAnton Lindqvist <anton@cvs.openbsd.org>2022-05-24 05:14:31 +0000
committerAnton Lindqvist <anton@cvs.openbsd.org>2022-05-24 05:14:31 +0000
commitfe7fbd30801e744e82725051be73791146bfd58f (patch)
treedeb173e508c835997277099191a0ec6ce2c6546a /regress/lib/libc/sys/t_truncate.c
parentdc489dfcd65c48b193eba920723fc9c0adf75991 (diff)
Recent changes to truncate(2) swapped the ordering of some validations
causing EACCESS as opposed of ESDIR to be returned while trying to truncate a directory as a user lacking write permissions to the same directory. As this behavior is reasonable, change the truncate directory from /etc/ to /tmp which makes the test pass both as root and non-root.
Diffstat (limited to 'regress/lib/libc/sys/t_truncate.c')
-rw-r--r--regress/lib/libc/sys/t_truncate.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/regress/lib/libc/sys/t_truncate.c b/regress/lib/libc/sys/t_truncate.c
index f952efc35e8..f42494f8db8 100644
--- a/regress/lib/libc/sys/t_truncate.c
+++ b/regress/lib/libc/sys/t_truncate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: t_truncate.c,v 1.3 2021/12/13 16:56:48 deraadt Exp $ */
+/* $OpenBSD: t_truncate.c,v 1.4 2022/05/24 05:14:30 anton Exp $ */
/* $NetBSD: t_truncate.c,v 1.3 2017/01/13 20:03:51 christos Exp $ */
/*-
@@ -157,7 +157,7 @@ ATF_TC_BODY(truncate_err, tc)
ATF_REQUIRE_ERRNO(EFAULT, truncate((void *)-1, 999) == -1);
errno = 0;
- ATF_REQUIRE_ERRNO(EISDIR, truncate("/etc", 999) == -1);
+ ATF_REQUIRE_ERRNO(EISDIR, truncate("/tmp", 999) == -1);
errno = 0;
ATF_REQUIRE_ERRNO(ENOENT, truncate("/a/b/c/d/e/f/g", 999) == -1);