mirror of
https://github.com/troglobit/finit.git
synced 2026-10-14 10:19:36 +00:00
Ensure all a process' children are in the same cgroup
The logger redirection process was sometimes in the init group instead of the system/<svc>/ group. This was due to the parent PID being moved after the logger was forked. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
9ee2be121f
commit
3bb826b22b
1 file changed
+6
-6
+6
-6
@@ -657,8 +657,13 @@ static int service_start(svc_t *svc)
|
||||
char *args[MAX_NUM_SVC_ARGS + 1];
|
||||
int status;
|
||||
|
||||
if (!svc_is_tty(svc))
|
||||
pid = getpid();
|
||||
if (svc_is_tty(svc)) {
|
||||
cgroup_user("getty", pid);
|
||||
} else {
|
||||
cgroup_service(group_name(svc, grnam, sizeof(grnam)), pid, &svc->cgroup);
|
||||
redirect(svc);
|
||||
}
|
||||
|
||||
if (!svc_is_sysv(svc)) {
|
||||
wordexp_t we = { 0 };
|
||||
@@ -806,11 +811,6 @@ static int service_start(svc_t *svc)
|
||||
dbg("Starting PID %d: %s", svc->pid, cmdline);
|
||||
}
|
||||
|
||||
if (svc_is_tty(svc))
|
||||
cgroup_user("getty", pid);
|
||||
else
|
||||
cgroup_service(group_name(svc, grnam, sizeof(grnam)), pid, &svc->cgroup);
|
||||
|
||||
if (!svc_is_sysv(svc))
|
||||
logit(LOG_CONSOLE | LOG_NOTICE, "Starting %s[%d]", svc_ident(svc, NULL, 0), pid);
|
||||
|
||||
|
||||
Reference in new issue
Block a user