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 When a hard link to a directory fails, ac...



details:   https://anonhg.NetBSD.org/src/rev/7450f6e76cd5
branches:  trunk
changeset: 795614:7450f6e76cd5
user:      martin <martin%NetBSD.org@localhost>
date:      Mon Apr 21 14:39:36 2014 +0000

description:
When a hard link to a directory fails, accept both EPERM and EACCESS as
valid error codes.

diffstat:

 tests/lib/libc/sys/t_link.c |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 37580d7e1593 -r 7450f6e76cd5 tests/lib/libc/sys/t_link.c
--- a/tests/lib/libc/sys/t_link.c       Mon Apr 21 11:06:55 2014 +0000
+++ b/tests/lib/libc/sys/t_link.c       Mon Apr 21 14:39:36 2014 +0000
@@ -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_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,



Home | Main Index | Thread Index | Old Index