summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormartin <martin@NetBSD.org>2014-04-21 14:39:36 +0000
committermartin <martin@NetBSD.org>2014-04-21 14:39:36 +0000
commit9568fb6df09e404d7fbf32012aa23fecafe47bef (patch)
tree483bd1c24663a6f7244116cb2b355381f3127533
parent5e6d10a7aa75c980344b087de96109d2cded9096 (diff)
When a hard link to a directory fails, accept both EPERM and EACCESS as
valid error codes.
-rw-r--r--tests/lib/libc/sys/t_link.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/lib/libc/sys/t_link.c b/tests/lib/libc/sys/t_link.c
index 3949184ba00..b58c4c9e6d8 100644
--- a/tests/lib/libc/sys/t_link.c
+++ b/tests/lib/libc/sys/t_link.c
@@ -1,4 +1,4 @@
-/* $NetBSD: t_link.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $ */
+/* $NetBSD: t_link.c,v 1.2 2014/04/21 14:39:36 martin Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: t_link.c,v 1.1 2011/07/07 06:57:53 jruoho Exp $");
+__RCSID("$NetBSD: t_link.c,v 1.2 2014/04/21 14:39:36 martin Exp $");
#include <sys/param.h>
#include <sys/stat.h>
@@ -160,9 +160,13 @@ ATF_TC_HEAD(link_perm, tc)
ATF_TC_BODY(link_perm, tc)
{
+ int rv;
- errno =0;
- ATF_REQUIRE_ERRNO(EACCES, link("/root", "/root.link") == -1);
+ errno = 0;
+ rv = link("/root", "/root.link");
+ ATF_REQUIRE_MSG(rv == -1 && (errno == EACCES || errno == EPERM),
+ "link to a directory did not fail with EPERM or EACCESS; link() "
+ "returned %d, errno %d", rv, errno);
errno = 0;
ATF_REQUIRE_ERRNO(EACCES,