From 7d68533bb99e3d1c8a83bea02ea7cf402125777c Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 6 Sep 2011 11:24:23 +0200 Subject: [PATCH] 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. --- ChangeLog | 6 ++++++ tests/test-sameacls.c | 48 +++++++++++++++++++++++++++---------------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/ChangeLog b/ChangeLog index 01a68e8880..cfdb8f22a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-09-06 Bruno Haible + + 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 acl: Fix a test failure on IRIX 6.5 with NFS. diff --git a/tests/test-sameacls.c b/tests/test-sameacls.c index 3fafa3c202..848af20ec4 100644 --- a/tests/test-sameacls.c +++ b/tests/test-sameacls.c @@ -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) { -- 2.39.5