From: Tom Gundersen Date: Tue, 4 Nov 2014 15:19:26 +0000 (+0100) Subject: test: fileio - make coverity happy X-Git-Tag: v218~551 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=696c24fced77b152dda45f0bdbcf6411849bd8ab test: fileio - make coverity happy Explicitly check the length of the read. Fixes CID#1250803. --- diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c index a713abde6..c26a6facb 100644 --- a/src/test/test-fileio.c +++ b/src/test/test-fileio.c @@ -342,7 +342,7 @@ static void test_write_string_file_no_create(void) { assert_se(write_string_file_no_create("/a/file/which/does/not/exists/i/guess", "boohoo") < 0); assert_se(write_string_file_no_create(fn, "boohoo") == 0); - assert_se(read(fd, buf, sizeof(buf))); + assert_se(read(fd, buf, sizeof(buf)) == strlen("boohoo\n")); assert_se(streq(buf, "boohoo\n")); unlink(fn);