summaryrefslogtreecommitdiff
path: root/src/tmpfiles/tmpfiles.c
diff options
context:
space:
mode:
authorFranck Bui <fbui@suse.com>2018-04-11 16:58:49 +0200
committerFranck Bui <fbui@suse.com>2018-04-24 11:57:48 +0200
commit4dfaa528d451aa7926be4f1b4cf8d0ffe338421d (patch)
tree22b36e22fac62135fac6c6213ff1f48ae866be98 /src/tmpfiles/tmpfiles.c
parent7b887f2284e2ada3e95494d5972d2f64f27fe81b (diff)
downloadsystemd-4dfaa528d451aa7926be4f1b4cf8d0ffe338421d.tar.gz
fs-util: introduce fchmod_opath()
fchmod(2) still doesn't take file descriptors opened with O_PATH.
Diffstat (limited to 'src/tmpfiles/tmpfiles.c')
-rw-r--r--src/tmpfiles/tmpfiles.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
index 5755f22160..4e437a57fd 100644
--- a/src/tmpfiles/tmpfiles.c
+++ b/src/tmpfiles/tmpfiles.c
@@ -808,15 +808,9 @@ static int fd_set_perms(Item *i, int fd, const struct stat *st) {
if (m == (st->st_mode & 07777))
log_debug("\"%s\" has correct mode %o already.", path, st->st_mode);
else {
- char procfs_path[STRLEN("/proc/self/fd/") + DECIMAL_STR_MAX(int)];
-
log_debug("Changing \"%s\" to mode %o.", path, m);
-
- /* fchmodat() still doesn't have AT_EMPTY_PATH flag. */
- xsprintf(procfs_path, "/proc/self/fd/%i", fd);
-
- if (chmod(procfs_path, m) < 0)
- return log_error_errno(errno, "chmod() of %s via %s failed: %m", path, procfs_path);
+ if (fchmod_opath(fd, m) < 0)
+ return log_error_errno(errno, "fchmod() of %s failed: %m", path);
}
}
}