mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
generator: check $SYSTEMD_SCOPE rather than cgroup membership
This is more explicit and ensures that even in testing environments we operate the same way. As side effect it also avoids the mess around SELinux blocking access to cgroupfs. Fixes: #35723
This commit is contained in:
@@ -1054,10 +1054,10 @@ int generator_write_veritysetup_service_section(
|
||||
void log_setup_generator(void) {
|
||||
if (invoked_by_systemd()) {
|
||||
/* Disable talking to syslog/journal (i.e. the two IPC-based loggers) if we run in system context. */
|
||||
if (cg_pid_get_owner_uid(0, NULL) == -ENXIO /* not running in a per-user slice */)
|
||||
if (streq_ptr(getenv("SYSTEMD_SCOPE"), "system"))
|
||||
log_set_prohibit_ipc(true);
|
||||
|
||||
/* This effectively means: journal for per-user generators, kmsg otherwise */
|
||||
/* This effectively means: journal for per-user service manager generators, kmsg for per-system service manager generators */
|
||||
log_set_target(LOG_TARGET_JOURNAL_OR_KMSG);
|
||||
} else
|
||||
log_set_target(LOG_TARGET_AUTO);
|
||||
|
||||
Reference in New Issue
Block a user