changeset 15576:5108c363f278

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.
author Bruno Haible <bruno@clisp.org>
date Tue, 06 Sep 2011 11:24:23 +0200
parents 3e19c8849877
children 15d6c13d7aae
files ChangeLog tests/test-sameacls.c
diffstat 2 files changed, 36 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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.
--- a/tests/test-sameacls.c
+++ b/tests/test-sameacls.c
@@ -523,32 +523,44 @@
   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 (errno == ENOSYS)
+        text1[0] = '\0';
+      else
+        {
+          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 ();
-    }
+  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 (errno == ENOSYS)
+        text2[0] = '\0';
+      else
+        {
+          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 ();
-    }
+  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)
     {