PERFORCE change 147313 for review
Edward Tomasz Napierala
trasz at FreeBSD.org
Wed Aug 13 17:07:31 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=147313
Change 147313 by trasz at trasz_traszkan on 2008/08/13 17:07:01
Merging (setfacl -m) and removing (setfacl -x) should affect all
the matching entries, not just the first one.
Affected files ...
.. //depot/projects/soc2008/trasz_nfs4acl/bin/setfacl/merge.c#8 edit
.. //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_delete_entry.c#6 edit
Differences ...
==== //depot/projects/soc2008/trasz_nfs4acl/bin/setfacl/merge.c#8 (text+ko) ====
@@ -129,8 +129,7 @@
/* check against the existing ACL entries */
entry_id_new = ACL_FIRST_ENTRY;
- while (have_entry == 0 &&
- acl_get_entry(acl_new, entry_id_new, &entry_new) == 1) {
+ while (acl_get_entry(acl_new, entry_id_new, &entry_new) == 1) {
entry_id_new = ACL_NEXT_ENTRY;
if (acl_get_tag_type(entry, &tag) == -1)
==== //depot/projects/soc2008/trasz_nfs4acl/lib/libc/posix1e/acl_delete_entry.c#6 (text+ko) ====
@@ -77,7 +77,7 @@
acl_delete_entry(acl_t acl, acl_entry_t entry_d)
{
struct acl *acl_int;
- int i, found = 0;
+ int i, j, found = 0;
if (acl == NULL || entry_d == NULL) {
errno = EINVAL;
@@ -96,21 +96,22 @@
errno = EINVAL;
return (-1);
}
- for (i = 0; i < acl->ats_acl.acl_cnt; i++) {
+ for (i = 0; i < acl->ats_acl.acl_cnt;) {
if (_entry_matches(&(acl->ats_acl.acl_entry[i]), entry_d)) {
/* ...shift the remaining entries... */
- for (; i < acl->ats_acl.acl_cnt - 1; ++i)
- acl->ats_acl.acl_entry[i] =
- acl->ats_acl.acl_entry[i+1];
+ for (j = i; j < acl->ats_acl.acl_cnt - 1; ++j)
+ acl->ats_acl.acl_entry[j] =
+ acl->ats_acl.acl_entry[j+1];
/* ...drop the count and zero the unused entry... */
acl->ats_acl.acl_cnt--;
- bzero(&acl->ats_acl.acl_entry[i],
+ bzero(&acl->ats_acl.acl_entry[j],
sizeof(struct acl_entry));
acl->ats_cur_entry = 0;
/* Continue with the loop to remove all maching entries. */
found = 1;
- }
+ } else
+ i++;
}
if (found)
More information about the p4-projects
mailing list