Use a more correct method of copying entire ACLs (fixes

operation under Linux).
This commit is contained in:
Chris D. Faulhaber 2002-02-03 02:37:43 +00:00
parent f353db9f9a
commit 42dcd8695a

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001 Chris D. Faulhaber
* Copyright (c) 2001-2002 Chris D. Faulhaber
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -41,7 +41,7 @@
int
set_acl_mask(acl_t *prev_acl)
{
acl_entry_t entry;
acl_entry_t entry, entry_new;
acl_t acl;
acl_tag_t tag;
int entry_id;
@ -104,7 +104,20 @@ set_acl_mask(acl_t *prev_acl)
return (0);
}
**prev_acl = *acl;
acl_free(*prev_acl);
*prev_acl = acl_init(ACL_MAX_ENTRIES);
if (*prev_acl == NULL)
err(1, "acl_init() failed");
entry_id = ACL_FIRST_ENTRY;
while (acl_get_entry(acl, entry_id, &entry) == 1) {
entry_id = ACL_NEXT_ENTRY;
if (acl_create_entry(prev_acl, &entry_new) == -1)
err(1, "acl_create_entry() failed");
if (acl_copy_entry(entry_new, entry) == -1)
err(1, "acl_copy_entry() failed");
}
acl_free(acl);
return (0);