chiark / gitweb /
test: silence a coverity report
authorThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Tue, 16 Sep 2014 19:59:50 +0000 (21:59 +0200)
committerThomas Hindoe Paaboel Andersen <phomes@gmail.com>
Tue, 16 Sep 2014 20:02:23 +0000 (22:02 +0200)
We check the actual contents of the file on the line after but we
might as well also check the number of bytes read here.

Found by coverity. Fixes: CID#1237521

src/test/test-fileio.c

index e69706c3f872bd0d7a3ee9f94e0743bb7eb63979..92aa794a9513a094b7eee19e2763bf5963acc36e 100644 (file)
@@ -325,7 +325,7 @@ static void test_write_string_file(void) {
 
         assert_se(write_string_file(fn, "boohoo") == 0);
 
-        assert_se(read(fd, buf, sizeof(buf)));
+        assert_se(read(fd, buf, sizeof(buf)) == 7);
         assert_se(streq(buf, "boohoo\n"));
 
         unlink(fn);