diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-12-12 13:42:06 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-12-21 19:07:55 +0100 |
commit | 2467cc55f139cf540dc1ed6da5f3774fcbab4475 (patch) | |
tree | 1cd1f4074f54a2bac518893df8860063cf9c86ad /src/basic/proc-cmdline.c | |
parent | 5cfc0a84610949854ae46a5f7f2e3a56077fa92d (diff) | |
download | systemd-2467cc55f139cf540dc1ed6da5f3774fcbab4475.tar.gz |
util-lib: read $SYSTEMD_PROC_CMDLINE if set when looking for the kernel cmdline
if we want to parse the kernel command line, let's check the
$SYSTEMD_PROC_CMDLINE environment variable first. This is useful for debugging
purposes.
Diffstat (limited to 'src/basic/proc-cmdline.c')
-rw-r--r-- | src/basic/proc-cmdline.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c index 8297a222b7..98c94ed5e2 100644 --- a/src/basic/proc-cmdline.c +++ b/src/basic/proc-cmdline.c @@ -34,8 +34,22 @@ #include "virt.h" int proc_cmdline(char **ret) { + const char *e; assert(ret); + /* For testing purposes it is sometimes useful to be able to override what we consider /proc/cmdline to be */ + e = secure_getenv("SYSTEMD_PROC_CMDLINE"); + if (e) { + char *m; + + m = strdup(e); + if (!m) + return -ENOMEM; + + *ret = m; + return 0; + } + if (detect_container() > 0) return get_process_cmdline(1, 0, false, ret); else |