diff options
author | Pat Coulthard <pmcoulthard@gmail.com> | 2020-10-25 22:45:13 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-10-26 10:20:10 +0100 |
commit | 3045c416e1cbbd8ab40577790522217fd1b9cb3b (patch) | |
tree | 5e9068dcc337c867d51891a79d67a72782cf37e6 /src/tmpfiles/tmpfiles.c | |
parent | NEWS: fix typo (`systemd-userdb` > `systemd-userdbd`) (diff) | |
download | systemd-3045c416e1cbbd8ab40577790522217fd1b9cb3b.tar.xz systemd-3045c416e1cbbd8ab40577790522217fd1b9cb3b.zip |
tmpfiles: Handle filesystems without ACL support in more cases.
Diffstat (limited to 'src/tmpfiles/tmpfiles.c')
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index b6596fd0c7..b42bc78934 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -1104,13 +1104,17 @@ static int path_set_acl(const char *path, const char *pretty, acl_type_t type, a strna(t), pretty); r = acl_set_file(path, type, dup); - if (r < 0) - /* Return positive to indicate we already warned */ - return -log_error_errno(errno, - "Setting %s ACL \"%s\" on %s failed: %m", - type == ACL_TYPE_ACCESS ? "access" : "default", - strna(t), pretty); - + if (r < 0) { + if (ERRNO_IS_NOT_SUPPORTED(errno)) + /* No error if filesystem doesn't support ACLs. Return negative. */ + return -errno; + else + /* Return positive to indicate we already warned */ + return -log_error_errno(errno, + "Setting %s ACL \"%s\" on %s failed: %m", + type == ACL_TYPE_ACCESS ? "access" : "default", + strna(t), pretty); + } return 0; } #endif @@ -1150,6 +1154,11 @@ static int fd_set_acls(Item *item, int fd, const char *path, const struct stat * if (r == 0 && item->acl_default && S_ISDIR(st->st_mode)) r = path_set_acl(procfs_path, path, ACL_TYPE_DEFAULT, item->acl_default, item->append_or_force); + if (ERRNO_IS_NOT_SUPPORTED(r)) { + log_debug_errno(r, "ACLs not supported by file system at %s", path); + return 0; + } + if (r > 0) return -r; /* already warned */ @@ -1157,10 +1166,6 @@ static int fd_set_acls(Item *item, int fd, const char *path, const struct stat * if (r == -ENOENT && proc_mounted() == 0) r = -ENOSYS; - if (r == -EOPNOTSUPP) { - log_debug_errno(r, "ACLs not supported by file system at %s", path); - return 0; - } if (r < 0) return log_error_errno(r, "ACL operation on \"%s\" failed: %m", path); #endif |