Merge pull request #15318 from fbuihuu/inherit-umask-for-user-units

pid1: by default make user units inherit their umask from the user ma…
This commit is contained in:
Lennart Poettering
2020-04-09 17:15:55 +02:00
committed by GitHub
4 changed files with 35 additions and 4 deletions
+17
View File
@@ -628,6 +628,23 @@ int get_process_ppid(pid_t pid, pid_t *_ppid) {
return 0;
}
int get_process_umask(pid_t pid, mode_t *umask) {
_cleanup_free_ char *m = NULL;
const char *p;
int r;
assert(umask);
assert(pid >= 0);
p = procfs_file_alloca(pid, "status");
r = get_proc_field(p, "Umask", WHITESPACE, &m);
if (r == -ENOENT)
return -ESRCH;
return parse_mode(m, umask);
}
int wait_for_terminate(pid_t pid, siginfo_t *status) {
siginfo_t dummy;
+1
View File
@@ -45,6 +45,7 @@ int get_process_cwd(pid_t pid, char **cwd);
int get_process_root(pid_t pid, char **root);
int get_process_environ(pid_t pid, char **environ);
int get_process_ppid(pid_t pid, pid_t *ppid);
int get_process_umask(pid_t pid, mode_t *umask);
int wait_for_terminate(pid_t pid, siginfo_t *status);