From owner-p4-projects@FreeBSD.ORG Wed Aug 13 17:07:31 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8EE801065672; Wed, 13 Aug 2008 17:07:30 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 51E86106567A for ; Wed, 13 Aug 2008 17:07:30 +0000 (UTC) (envelope-from trasz@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 4D5628FC1F for ; Wed, 13 Aug 2008 17:07:30 +0000 (UTC) (envelope-from trasz@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.2/8.14.2) with ESMTP id m7DH7Us8077424 for ; Wed, 13 Aug 2008 17:07:30 GMT (envelope-from trasz@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.2/8.14.1/Submit) id m7DH7Uav077422 for perforce@freebsd.org; Wed, 13 Aug 2008 17:07:30 GMT (envelope-from trasz@freebsd.org) Date: Wed, 13 Aug 2008 17:07:30 GMT Message-Id: <200808131707.m7DH7Uav077422@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to trasz@freebsd.org using -f From: Edward Tomasz Napierala To: Perforce Change Reviews Cc: Subject: PERFORCE change 147313 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Aug 2008 17:07:31 -0000 http://perforce.freebsd.org/chv.cgi?CH=147313 Change 147313 by trasz@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)