summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-03-27 09:18:50 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-03-27 11:52:54 +0100
commitb45556375e0b9989a1245a36fcb673b95eb21f43 (patch)
treee83fbe9c419ff5e0c9b667d43c261bbff642021b /src/test
parentMerge pull request #12109 from poettering/sleep-minifixes (diff)
downloadsystemd-b45556375e0b9989a1245a36fcb673b95eb21f43.tar.xz
systemd-b45556375e0b9989a1245a36fcb673b95eb21f43.zip
test-fileio: do not use variable before checking return value
Coverity is unhappy because we use "line" in the assert that checks the return value. It doesn't matter much, but let's clean this up. Also, let's not assume that /proc/cmdline contains anything. CID #1400219.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-fileio.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index 3dd4287ff0..2ff5b9a69d 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -759,7 +759,11 @@ static void test_read_line3(void) {
assert_se(f);
r = read_line(f, LINE_MAX, &line);
- assert_se((size_t) r == strlen(line) + 1);
+ assert_se(r >= 0);
+ if (r == 0)
+ assert_se(line && isempty(line));
+ else
+ assert_se((size_t) r == strlen(line) + 1);
assert_se(read_line(f, LINE_MAX, NULL) == 0);
}