acl: Fix a test failure on AIX >= 5.3 with NFS.
authorBruno Haible <bruno@clisp.org>
Tue, 6 Sep 2011 09:24:23 +0000 (11:24 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 6 Sep 2011 09:24:23 +0000 (11:24 +0200)
* tests/test-sameacls.c (main): Interpret aclx_get failure with ENOSYS
as no ACL.

ChangeLog
tests/test-sameacls.c

index 01a68e8..cfdb8f2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-09-06  Bruno Haible  <bruno@clisp.org>
 
+       acl: Fix a test failure on AIX >= 5.3 with NFS.
+       * tests/test-sameacls.c (main): Interpret aclx_get failure with ENOSYS
+       as no ACL.
+
+2011-09-06  Bruno Haible  <bruno@clisp.org>
+
        acl: Fix a test failure on IRIX 6.5 with NFS.
        * lib/acl-internal.h (MODE_INSIDE_ACL): Define to 0 on IRIX.
        * lib/set-mode-acl.c (qset_acl): Test !HAVE_ACL_TYPE_EXTENDED instead
index 3fafa3c..848af20 100644 (file)
@@ -523,32 +523,44 @@ main (int argc, char *argv[])
   type1.u64 = ACL_ANY;
   if (aclx_get (file1, 0, &type1, acl1, &aclsize1, &mode1) < 0)
     {
-      fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
-      fflush (stderr);
-      abort ();
-    }
-  if (aclx_printStr (text1, &textsize1, acl1, aclsize1, type1, file1, 0) < 0)
-    {
-      fprintf (stderr, "cannot convert the ACLs of file %s to text\n", file1);
-      fflush (stderr);
-      abort ();
+      if (errno == ENOSYS)
+        text1[0] = '\0';
+      else
+        {
+          fprintf (stderr, "error accessing the ACLs of file %s\n", file1);
+          fflush (stderr);
+          abort ();
+        }
     }
+  else
+    if (aclx_printStr (text1, &textsize1, acl1, aclsize1, type1, file1, 0) < 0)
+      {
+        fprintf (stderr, "cannot convert the ACLs of file %s to text\n", file1);
+        fflush (stderr);
+        abort ();
+      }
 
   /* The docs say that type2 being 0 is equivalent to ACL_ANY, but it is not
      true, in AIX 5.3.  */
   type2.u64 = ACL_ANY;
   if (aclx_get (file2, 0, &type2, acl2, &aclsize2, &mode2) < 0)
     {
-      fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
-      fflush (stderr);
-      abort ();
-    }
-  if (aclx_printStr (text2, &textsize2, acl2, aclsize2, type2, file2, 0) < 0)
-    {
-      fprintf (stderr, "cannot convert the ACLs of file %s to text\n", file2);
-      fflush (stderr);
-      abort ();
+      if (errno == ENOSYS)
+        text2[0] = '\0';
+      else
+        {
+          fprintf (stderr, "error accessing the ACLs of file %s\n", file2);
+          fflush (stderr);
+          abort ();
+        }
     }
+  else
+    if (aclx_printStr (text2, &textsize2, acl2, aclsize2, type2, file2, 0) < 0)
+      {
+        fprintf (stderr, "cannot convert the ACLs of file %s to text\n", file2);
+        fflush (stderr);
+        abort ();
+      }
 
   if (strcmp (text1, text2) != 0)
     {