acl: Fix a test failure on AIX >= 5.3 with NFS.
[gnulib.git] / tests / test-sameacls.c
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)
     {