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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user