summaryrefslogtreecommitdiff
path: root/lib/copy-acl.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2012-02-19 22:17:05 +0100
committerBruno Haible <bruno@clisp.org>2012-02-19 22:17:05 +0100
commit1e5535ce0c17e7e605e71d7423789a3d5254d9f7 (patch)
tree331a4f4d4b91fa82d7988e8e5e06065155160a79 /lib/copy-acl.c
parentec10a26aea109e60b185b026a84d68d4ebb50952 (diff)
downloadgnulib-1e5535ce0c17e7e605e71d7423789a3d5254d9f7.tar.gz
acl: Fix endless loop on Solaris with vxfs.
* lib/file-has-acl.c (file_has_acl) [Solaris]: Treat a failing acl()/facl() call for ACE_GETACL like a failing call for ACE_GETACLCNT. * lib/set-mode-acl.c (qset_acl) [Solaris]: Likewise. * lib/copy-acl.c (qcopy_acl)[Solaris]: Likewise. * tests/test-sameacls.c (main)[Solaris]: Likewise. Reported by Bill Jones in <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10639>, via Paul Eggert.
Diffstat (limited to 'lib/copy-acl.c')
-rw-r--r--lib/copy-acl.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/lib/copy-acl.c b/lib/copy-acl.c
index 9b9f033dd6..685d4cf446 100644
--- a/lib/copy-acl.c
+++ b/lib/copy-acl.c
@@ -235,10 +235,22 @@ qcopy_acl (const char *src_name, int source_desc, const char *dst_name,
return -2;
}
- if ((source_desc != -1
- ? facl (source_desc, ACE_GETACL, ace_count, ace_entries)
- : acl (src_name, ACE_GETACL, ace_count, ace_entries))
- == ace_count)
+ ret = (source_desc != -1
+ ? facl (source_desc, ACE_GETACL, ace_count, ace_entries)
+ : acl (src_name, ACE_GETACL, ace_count, ace_entries));
+ if (ret < 0)
+ {
+ free (ace_entries);
+ if (errno == ENOSYS || errno == EINVAL)
+ {
+ ace_count = 0;
+ ace_entries = NULL;
+ break;
+ }
+ else
+ return -2;
+ }
+ if (ret == ace_count)
break;
/* Huh? The number of ACL entries changed since the last call.
Repeat. */