mirror of
https://github.com/troglobit/finit.git
synced 2026-10-31 13:00:32 +00:00
Fix #361: cgroup move fail if starting service as non-root
Regression in v4.4 Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
5769500afe
commit
450f498061
1 file changed
+9
-7
+9
-7
@@ -575,7 +575,6 @@ static int service_start(svc_t *svc)
|
|||||||
int result = 0, do_progress = 1;
|
int result = 0, do_progress = 1;
|
||||||
char cmdline[CMD_SIZE] = "";
|
char cmdline[CMD_SIZE] = "";
|
||||||
sigset_t nmask, omask;
|
sigset_t nmask, omask;
|
||||||
char grnam[80];
|
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
@@ -644,19 +643,22 @@ static int service_start(svc_t *svc)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
if (pid > 1) {
|
if (pid > 1) {
|
||||||
|
char grnam[80];
|
||||||
|
|
||||||
svc->pid = pid;
|
svc->pid = pid;
|
||||||
svc->start_time = jiffies();
|
svc->start_time = jiffies();
|
||||||
|
|
||||||
|
if (svc_is_tty(svc))
|
||||||
|
cgroup_user("getty", pid);
|
||||||
|
else
|
||||||
|
cgroup_service(group_name(svc, grnam, sizeof(grnam)), pid, &svc->cgroup);
|
||||||
|
|
||||||
} else if (pid == 0) {
|
} else if (pid == 0) {
|
||||||
char *args[MAX_NUM_SVC_ARGS + 1];
|
char *args[MAX_NUM_SVC_ARGS + 1];
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
pid = getpid();
|
if (!svc_is_tty(svc))
|
||||||
if (svc_is_tty(svc)) {
|
|
||||||
cgroup_user("getty", pid);
|
|
||||||
} else {
|
|
||||||
cgroup_service(group_name(svc, grnam, sizeof(grnam)), pid, &svc->cgroup);
|
|
||||||
redirect(svc);
|
redirect(svc);
|
||||||
}
|
|
||||||
|
|
||||||
if (!svc_is_sysv(svc)) {
|
if (!svc_is_sysv(svc)) {
|
||||||
wordexp_t we = { 0 };
|
wordexp_t we = { 0 };
|
||||||
|
|||||||
Reference in new issue
Block a user