diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-11-23 15:49:51 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-12-18 12:35:57 +0900 |
commit | 94566540e3863032df3a8a89f948b94d764ca2b4 (patch) | |
tree | c0a5b43695c1db323d59b7af4da8a8130bba79d1 /src/tmpfiles | |
parent | 459631a0f9157926eb9c4ab66036b4bd8471d7f6 (diff) | |
download | systemd-94566540e3863032df3a8a89f948b94d764ca2b4.tar.gz |
tmpfiles: try to set file attributes one by one
Closes #17690.
Diffstat (limited to 'src/tmpfiles')
-rw-r--r-- | src/tmpfiles/tmpfiles.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 9906c70eef..2bbacf0ccf 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -1308,11 +1308,15 @@ static int fd_set_attribute(Item *item, int fd, const char *path, const struct s if (procfs_fd < 0) return log_error_errno(procfs_fd, "Failed to re-open '%s': %m", path); - r = chattr_fd(procfs_fd, f, item->attribute_mask, NULL); - if (r < 0) - log_full_errno(IN_SET(r, -ENOTTY, -EOPNOTSUPP) ? LOG_DEBUG : LOG_WARNING, - r, - "Cannot set file attribute for '%s', value=0x%08x, mask=0x%08x, ignoring: %m", + unsigned previous, current; + r = chattr_full(NULL, procfs_fd, f, item->attribute_mask, &previous, ¤t, true); + if (r == -ENOANO) + log_warning("Cannot set file attributes for '%s', maybe due to incompatiblity in specified attributes, " + "previous=0x%08x, current=0x%08x, expected=0x%08x, ignoring.", + path, previous, current, (previous & ~item->attribute_mask) | (f & item->attribute_mask)); + else if (r < 0) + log_full_errno(ERRNO_IS_NOT_SUPPORTED(r) ? LOG_DEBUG : LOG_WARNING, r, + "Cannot set file attributes for '%s', value=0x%08x, mask=0x%08x, ignoring: %m", path, item->attribute_value, item->attribute_mask); return 0; |