diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-07-18 17:13:09 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-07-22 09:06:22 +0200 |
commit | 5f4a88239523ca4f4298b262f7ca4fcbb8884f3c (patch) | |
tree | 3ef8a6db7aba9adca22cbb43abc8a536ce81a21d /src | |
parent | 03909b1e23833a4c08818a16f26e60e19517f06c (diff) | |
download | systemd-5f4a88239523ca4f4298b262f7ca4fcbb8884f3c.tar.gz systemd-5f4a88239523ca4f4298b262f7ca4fcbb8884f3c.tar.bz2 systemd-5f4a88239523ca4f4298b262f7ca4fcbb8884f3c.zip |
pid1: make sure we look at /proc/1/cmdline when parsing config
In recent systemd-nspawn we wouldn't parse init args like systemd.log-level=debug.
This is because we wouldn't even look at /proc/1/cmdline.
$ systemd-nspawn -n cat /proc/1/stat
1 (cat) R 0 1 1 34816 ....
^^^^^
34816 is 136:0 a.k.a. /dev/pts/0.
Diffstat (limited to 'src')
-rw-r--r-- | src/basic/log.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/basic/log.c b/src/basic/log.c index 31ecbd1d1b..f047203271 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -1101,9 +1101,10 @@ void log_parse_environment_realm(LogRealm realm) { const char *e; - if (get_ctty_devnr(0, NULL) < 0) - /* Only try to read the command line in daemons. We assume that anything that has a controlling tty is - user stuff. */ + if (getpid_cached() == 1 || get_ctty_devnr(0, NULL) < 0) + /* Only try to read the command line in daemons. We assume that anything that has a + * controlling tty is user stuff. For PID1 we do a special check in case it hasn't + * closed the console yet. */ (void) proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_STRIP_RD_PREFIX); e = getenv("SYSTEMD_LOG_TARGET"); |