summaryrefslogtreecommitdiff
path: root/src/test/test-fileio.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-07-11 07:54:04 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-07-12 00:17:45 +0200
commit2aa07538bad3efb54309ada63fdaa1273ffbd1a2 (patch)
treeca75bd5f58aad388acc053941f54fa3f681ee2eb /src/test/test-fileio.c
parent67da2cc883fb261d2f9e5819df5646b2165196a8 (diff)
downloadsystemd-2aa07538bad3efb54309ada63fdaa1273ffbd1a2.tar.gz
test: minor modernization
Coverity was complaining that read() does not terminate the data. But we did that termination earlier, so covirity is wrong (CID#1402306, CID#1402340). Let's modernize the style a bit nevertheless. (size_t) cast is needed to avoid the warning about comparison, iff the value is not a constant.
Diffstat (limited to 'src/test/test-fileio.c')
-rw-r--r--src/test/test-fileio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
index 211def88eb..1ad47a4aa3 100644
--- a/src/test/test-fileio.c
+++ b/src/test/test-fileio.c
@@ -427,7 +427,7 @@ static void test_write_string_file(void) {
static void test_write_string_file_no_create(void) {
_cleanup_(unlink_tempfilep) char fn[] = "/tmp/test-write_string_file_no_create-XXXXXX";
_cleanup_close_ int fd;
- char buf[64] = {0};
+ char buf[64] = {};
fd = mkostemp_safe(fn);
assert_se(fd >= 0);
@@ -435,7 +435,7 @@ static void test_write_string_file_no_create(void) {
assert_se(write_string_file("/a/file/which/does/not/exists/i/guess", "boohoo", 0) < 0);
assert_se(write_string_file(fn, "boohoo", 0) == 0);
- assert_se(read(fd, buf, sizeof(buf)) == STRLEN("boohoo\n"));
+ assert_se(read(fd, buf, sizeof buf) == (ssize_t) strlen("boohoo\n"));
assert_se(streq(buf, "boohoo\n"));
}