acl: Complete the 2010-08-10 fix.
authorBruno Haible <bruno@clisp.org>
Sun, 12 Jun 2011 23:17:20 +0000 (01:17 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 12 Jun 2011 23:17:20 +0000 (01:17 +0200)
* lib/file-has-acl.c (file_has_acl) [HP-UX]: Also test against ENOTSUP.
* lib/set-mode-acl.c (qset_acl) [HP-UX]: Likewise.
* lib/copy-acl.c (qcopy_acl) [HP-UX]: Test for the errno values
explicitly.
* tests/test-sameacls.c (main) [HP-UX]: Also test against ENOTSUP.
Reported in <http://debbugs.gnu.org/db/60/6053.html>.

ChangeLog
lib/copy-acl.c
lib/file-has-acl.c
lib/set-mode-acl.c
tests/test-sameacls.c

index 498caed..5a0d7af 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2011-06-12  Bruno Haible  <bruno@clisp.org>
 
+       acl: Complete the 2010-08-10 fix.
+       * lib/file-has-acl.c (file_has_acl) [HP-UX]: Also test against ENOTSUP.
+       * lib/set-mode-acl.c (qset_acl) [HP-UX]: Likewise.
+       * lib/copy-acl.c (qcopy_acl) [HP-UX]: Test for the errno values
+       explicitly.
+       * tests/test-sameacls.c (main) [HP-UX]: Also test against ENOTSUP.
+       Reported in <http://debbugs.gnu.org/db/60/6053.html>.
+
+2011-06-12  Bruno Haible  <bruno@clisp.org>
+
        spawn-pipe tests: Comments.
        * tests/test-spawn-pipe-child.c (main): Update comment.
        Reported by James Youngman <jay@gnu.org>.
index f0dc116..d933fa2 100644 (file)
@@ -420,7 +420,7 @@ qcopy_acl (const char *src_name, int source_desc, const char *dst_name,
 
       if (count < 0)
         {
-          if (ACL_NOT_WELL_SUPPORTED (errno))
+          if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
             {
               count = 0;
               break;
@@ -455,7 +455,7 @@ qcopy_acl (const char *src_name, int source_desc, const char *dst_name,
     {
       int saved_errno = errno;
 
-      if (ACL_NOT_WELL_SUPPORTED (errno))
+      if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
         {
           struct stat source_statbuf;
 
index a815e4c..03decf4 100644 (file)
@@ -527,7 +527,15 @@ file_has_acl (char const *name, struct stat const *sb)
           count = getacl (name, 0, NULL);
 
           if (count < 0)
-            return (errno == ENOSYS || errno == EOPNOTSUPP ? 0 : -1);
+            {
+              /* ENOSYS is seen on newer HP-UX versions.
+                 EOPNOTSUPP is typically seen on NFS mounts.
+                 ENOTSUP was seen on Quantum StorNext file systems (cvfs).  */
+              if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
+                return 0;
+              else
+                return -1;
+            }
 
           if (count == 0)
             return 0;
index 377597c..1392378 100644 (file)
@@ -432,7 +432,7 @@ qset_acl (char const *name, int desc, mode_t mode)
     ret = setacl (name, sizeof (entries) / sizeof (struct acl_entry), entries);
   if (ret < 0)
     {
-      if (errno == ENOSYS || errno == EOPNOTSUPP)
+      if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
         return chmod_or_fchmod (name, desc, mode);
       return -1;
     }
index 0f777b5..661a926 100644 (file)
@@ -360,10 +360,12 @@ main (int argc, char *argv[])
   int count2;
 
   count1 = getacl (file1, 0, NULL);
-  if (count1 < 0 && (errno == ENOSYS || errno == EOPNOTSUPP))
+  if (count1 < 0
+      && (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP))
     count1 = 0;
   count2 = getacl (file2, 0, NULL);
-  if (count2 < 0 && (errno == ENOSYS || errno == EOPNOTSUPP))
+  if (count2 < 0
+      && (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP))
     count2 = 0;
 
   if (count1 < 0)