diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c index 39e9f2c668..6203b79959 100644 --- a/src/basic/proc-cmdline.c +++ b/src/basic/proc-cmdline.c @@ -98,7 +98,7 @@ int proc_cmdline(char **ret) { if (detect_container() > 0) return get_process_cmdline(1, SIZE_MAX, 0, ret); else - return read_one_line_file("/proc/cmdline", ret); + return read_full_file("/proc/cmdline", ret, NULL); } static int proc_cmdline_strv_internal(char ***ret, bool filter_pid1_args) { @@ -128,7 +128,7 @@ static int proc_cmdline_strv_internal(char ***ret, bool filter_pid1_args) { } else { _cleanup_free_ char *s = NULL; - r = read_one_line_file("/proc/cmdline", &s); + r = read_full_file("/proc/cmdline", &s, NULL); if (r < 0) return r; diff --git a/test/TEST-02-UNITTESTS/test.sh b/test/TEST-02-UNITTESTS/test.sh index 3d766db3e7..3646aa678e 100755 --- a/test/TEST-02-UNITTESTS/test.sh +++ b/test/TEST-02-UNITTESTS/test.sh @@ -14,6 +14,9 @@ KERNEL_APPEND=" frobnicate! +systemd.setenv=TEST_CMDLINE_NEWLINE=foo +systemd.setenv=TEST_CMDLINE_NEWLINE=bar + $KERNEL_APPEND " diff --git a/test/units/testsuite-02.sh b/test/units/testsuite-02.sh index d8aaacb913..ca54fc4018 100755 --- a/test/units/testsuite-02.sh +++ b/test/units/testsuite-02.sh @@ -3,6 +3,12 @@ set -eux set -o pipefail +if ! systemd-detect-virt -qc && [[ "${TEST_CMDLINE_NEWLINE:-}" != bar ]]; then + cat /proc/cmdline + echo >&2 "Expected TEST_CMDLINE_NEWLINE=bar from the kernel command line" + exit 1 +fi + NPROC=$(nproc) MAX_QUEUE_SIZE=${NPROC:-2} TESTS_GLOB=${TESTS_GLOB:-test-*}