chiark / gitweb /
core: ignore errors from cg_create_and_attach() in test mode (#8401)
authorMichal Sekletar <msekletar@users.noreply.github.com>
Fri, 9 Mar 2018 22:30:32 +0000 (23:30 +0100)
committerSven Eden <yamakuzure@gmx.net>
Thu, 28 Jun 2018 07:23:09 +0000 (09:23 +0200)
commitcd251ea623a3209de23462953677b29af92fab5b
treebe5dc15e8d945efb1e1dfdf07a26e56e42f9617a
parent6341577dfd51022072eb1eb923e1ad732435afb3
core: ignore errors from cg_create_and_attach() in test mode (#8401)

Reproducer:

$ meson build && cd build
$ ninja
$ sudo useradd test
$ sudo su test
$ ./systemd --system --test
...
Failed to create /user.slice/user-1000.slice/session-6.scope/init.scope control group: Permission denied
Failed to allocate manager object: Permission denied

Above error message is caused by the fact that user test didn't have its
own session and we tried to set up init.scope already running as user
test in the directory owned by different user.

Let's try to setup cgroup hierarchy, but if that fails return error only
when not running in the test mode.

Fixes #8072

(cherry picked from commit aa77e234fce7413b7dd64f99ea51450f2e2e9dbd)
src/core/cgroup.c