bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

linkat on Solaris 11


From: Bruno Haible
Subject: linkat on Solaris 11
Date: Mon, 27 Dec 2010 19:05:14 +0100
User-agent: KMail/1.9.9

Hi Eric, Jim, Paul,

On Solaris 11 from 2010-11, I get this test failure:

  test-linkat.c:194: assertion failed
  /bin/sh: line 10: 4267: Abort(coredump)
  FAIL: test-linkat

The reason is that this expression
  linkat (dfd, BASE "link1", dfd, BASE "sub1/", 0)
fails with error ENOTDIR, not EEXIST.

Here are two possible fixes: One in the testsuite, one in the linkat()
replacement (but this one costs CPU cycles at runtime). Which one do you
prefer?


--- tests/test-linkat.c.orig    Mon Dec 27 19:03:06 2010
+++ tests/test-linkat.c Mon Dec 27 19:02:03 2010
@@ -180,7 +180,7 @@
   ASSERT (errno == EEXIST || errno == EPERM || errno == EACCES);
   errno = 0;
   ASSERT (linkat (dfd, BASE "link1", dfd, BASE "sub1/", 0) == -1);
-  ASSERT (errno == EEXIST);
+  ASSERT (errno == EEXIST || errno == ENOTDIR);
   errno = 0;
   ASSERT (linkat (dfd, BASE "link1", dfd, BASE "sub1",
                   AT_SYMLINK_FOLLOW) == -1);


--- lib/linkat.c.orig   Mon Dec 27 19:03:06 2010
+++ lib/linkat.c        Mon Dec 27 19:02:58 2010
@@ -284,7 +284,10 @@
           return -1;
         if (!S_ISDIR (st.st_mode))
           {
-            errno = ENOTDIR;
+            if (fstatat (fd2, file2, &st, AT_SYMLINK_NOFOLLOW) >= 0)
+              errno = EEXIST;
+            else
+              errno = ENOTDIR;
             return -1;
           }
       }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]