1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-10 05:18:17 +03:00

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-03-27 09:18:50 +01:00
parent a1917c55c3
commit b45556375e

View File

@ -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);
}