Merge pull request #8801 from fbuihuu/tmpfiles-fixes

Tmpfiles fixes
This commit is contained in:
Lennart Poettering
2018-04-24 17:29:10 +02:00
committed by GitHub
3 changed files with 23 additions and 12 deletions
+15
View File
@@ -241,6 +241,21 @@ int fchmod_umask(int fd, mode_t m) {
return r;
}
int fchmod_opath(int fd, mode_t m) {
char procfs_path[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int)];
/* This function operates also on fd that might have been opened with
* O_PATH. Indeed fchmodat() doesn't have the AT_EMPTY_PATH flag like
* fchownat() does. */
xsprintf(procfs_path, "/proc/self/fd/%i", fd);
if (chmod(procfs_path, m) < 0)
return -errno;
return 0;
}
int fd_warn_permissions(const char *path, int fd) {
struct stat st;
+1
View File
@@ -33,6 +33,7 @@ int readlink_and_make_absolute(const char *p, char **r);
int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid);
int fchmod_umask(int fd, mode_t mode);
int fchmod_opath(int fd, mode_t m);
int fd_warn_permissions(const char *path, int fd);