Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2016-01-07 01:00:51 +0300
committerCorinna Vinschen <corinna@vinschen.de>2016-02-18 16:00:12 +0300
commit5bd7802967bd3ee81ce6db0de65412b7ac1f42ff (patch)
treef6edb340dee16c0f569f8db13b27770549e0193f
parent53ed352048438e5e7fa8f84b87ec3f10a0e35f5d (diff)
acl_create_entry: Don't invalidate existing entry_d and permset_d.topic/posix_acl_funcs
* sec_posixacl .cc (__acl_dup): Remove. (acl_dup): Fold __acl_dup functionality into this function. (acl_create_entry): Don't create new acl_t. Just realloc acl->entry to make room for new aclent_t. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
-rw-r--r--winsup/cygwin/sec_posixacl.cc27
1 files changed, 11 insertions, 16 deletions
diff --git a/winsup/cygwin/sec_posixacl.cc b/winsup/cygwin/sec_posixacl.cc
index 54bac8f69..8760ad5ec 100644
--- a/winsup/cygwin/sec_posixacl.cc
+++ b/winsup/cygwin/sec_posixacl.cc
@@ -48,22 +48,21 @@ acl_init (int count)
return acl;
}
-static acl_t
-__acl_dup (acl_t acl, int max)
+extern "C" acl_t
+acl_dup (acl_t acl)
{
__try
{
- acl_t new_acl = acl_init (max);
+ acl_t new_acl = acl_init (acl->max_count);
if (new_acl)
{
- int new_idx = 0;
+ uint16_t new_idx = 0;
for (uint16_t idx = 0; idx < acl->count; ++idx)
if (acl->entry[idx].a_type != ACL_DELETED_TAG)
new_acl->entry[new_idx++] = acl->entry[idx];
new_acl->magic = ACL_MAGIC;
new_acl->count = new_idx;
- new_acl->max_count = max;
return new_acl;
}
}
@@ -72,12 +71,6 @@ __acl_dup (acl_t acl, int max)
return NULL;
}
-extern "C" acl_t
-acl_dup (acl_t acl)
-{
- return __acl_dup (acl, acl->max_count);
-}
-
extern "C" int
acl_free (void *obj_p)
{
@@ -159,12 +152,14 @@ acl_create_entry (acl_t *acl_p, acl_entry_t *entry_p)
}
if (acl->count >= acl->max_count)
{
- acl_t new_acl = __acl_dup (acl, acl->count + 1);
- if (!new_acl)
+ aclent_t *new_e;
+
+ new_e = (aclent_t *) realloc (acl->entry,
+ _ENTRY_SIZE (acl->max_count + 1));
+ if (!new_e)
__leave;
- *acl_p = new_acl;
- acl_free (acl);
- acl = *acl_p;
+ acl->entry = new_e;
+ ++acl->max_count;
}
idx = acl->count++;
*entry_p = __to_entry (acl, idx);