1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

journal: use automatic clenup for ACL types

This commit is contained in:
Lennart Poettering 2015-10-02 23:20:51 +02:00
parent 65089b8240
commit 0fb398316c

View File

@ -193,7 +193,7 @@ static uint64_t available_space(Server *s, bool verbose) {
void server_fix_perms(Server *s, JournalFile *f, uid_t uid) { void server_fix_perms(Server *s, JournalFile *f, uid_t uid) {
int r; int r;
#ifdef HAVE_ACL #ifdef HAVE_ACL
acl_t acl; _cleanup_(acl_freep) acl_t acl = NULL;
acl_entry_t entry; acl_entry_t entry;
acl_permset_t permset; acl_permset_t permset;
#endif #endif
@ -221,7 +221,7 @@ void server_fix_perms(Server *s, JournalFile *f, uid_t uid) {
acl_set_tag_type(entry, ACL_USER) < 0 || acl_set_tag_type(entry, ACL_USER) < 0 ||
acl_set_qualifier(entry, &uid) < 0) { acl_set_qualifier(entry, &uid) < 0) {
log_warning_errno(errno, "Failed to patch ACL on %s, ignoring: %m", f->path); log_warning_errno(errno, "Failed to patch ACL on %s, ignoring: %m", f->path);
goto finish; return;
} }
} }
@ -231,14 +231,12 @@ void server_fix_perms(Server *s, JournalFile *f, uid_t uid) {
acl_add_perm(permset, ACL_READ) < 0 || acl_add_perm(permset, ACL_READ) < 0 ||
calc_acl_mask_if_needed(&acl) < 0) { calc_acl_mask_if_needed(&acl) < 0) {
log_warning_errno(errno, "Failed to patch ACL on %s, ignoring: %m", f->path); log_warning_errno(errno, "Failed to patch ACL on %s, ignoring: %m", f->path);
goto finish; return;
} }
if (acl_set_fd(f->fd, acl) < 0) if (acl_set_fd(f->fd, acl) < 0)
log_warning_errno(errno, "Failed to set ACL on %s, ignoring: %m", f->path); log_warning_errno(errno, "Failed to set ACL on %s, ignoring: %m", f->path);
finish:
acl_free(acl);
#endif #endif
} }