summaryrefslogtreecommitdiffstats
path: root/src/test/test-process-util.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-11-01 01:01:40 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-12-06 15:42:25 +0100
commitaa9de5b1c0ed9cd7ae0dec0dcaf19c18be846d7e (patch)
treef36e7dbe02c9e6b8a05a6a266afa2edb4a1456e5 /src/test/test-process-util.c
parentprocess-util: rename function arguments for storing results (diff)
downloadsystemd-aa9de5b1c0ed9cd7ae0dec0dcaf19c18be846d7e.tar.xz
systemd-aa9de5b1c0ed9cd7ae0dec0dcaf19c18be846d7e.zip
process-util: handle double NUL as the end of command line
Fixes #21186.
Diffstat (limited to 'src/test/test-process-util.c')
-rw-r--r--src/test/test-process-util.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c
index a180f3f9b4..ab093a7457 100644
--- a/src/test/test-process-util.c
+++ b/src/test/test-process-util.c
@@ -484,8 +484,8 @@ TEST(get_process_cmdline_harder) {
/* Test with multiple arguments that do require quoting */
#define CMDLINE1 "foo\0'bar'\0\"bar$\"\0x y z\0!``\0"
-#define EXPECT1 "foo \"'bar'\" \"\\\"bar\\$\\\"\" \"x y z\" \"!\\`\\`\" \"\""
-#define EXPECT1p "foo $'\\'bar\\'' $'\"bar$\"' $'x y z' $'!``' \"\""
+#define EXPECT1 "foo \"'bar'\" \"\\\"bar\\$\\\"\" \"x y z\" \"!\\`\\`\""
+#define EXPECT1p "foo $'\\'bar\\'' $'\"bar$\"' $'x y z' $'!``'"
assert_se(lseek(fd, SEEK_SET, 0) == 0);
assert_se(write(fd, CMDLINE1, sizeof CMDLINE1) == sizeof CMDLINE1);
assert_se(ftruncate(fd, sizeof CMDLINE1) == 0);
@@ -503,8 +503,8 @@ TEST(get_process_cmdline_harder) {
line = mfree(line);
#define CMDLINE2 "foo\0\1\2\3\0\0"
-#define EXPECT2 "foo \"\\001\\002\\003\" \"\" \"\""
-#define EXPECT2p "foo $'\\001\\002\\003' \"\" \"\""
+#define EXPECT2 "foo \"\\001\\002\\003\""
+#define EXPECT2p "foo $'\\001\\002\\003'"
assert_se(lseek(fd, SEEK_SET, 0) == 0);
assert_se(write(fd, CMDLINE2, sizeof CMDLINE2) == sizeof CMDLINE2);
assert_se(ftruncate(fd, sizeof CMDLINE2) == 0);