teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame 0273-test-silence-a-coverity-report.patch

Zbigniew Jędrzejewski-Szmek 62fe94
From cca0efb0477f9bb7d61b48ba270b885b29c0bb72 Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek 62fe94
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
Zbigniew Jędrzejewski-Szmek 62fe94
Date: Tue, 16 Sep 2014 21:59:50 +0200
Zbigniew Jędrzejewski-Szmek 62fe94
Subject: [PATCH] test: silence a coverity report
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
We check the actual contents of the file on the line after but we
Zbigniew Jędrzejewski-Szmek 62fe94
might as well also check the number of bytes read here.
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
Found by coverity. Fixes: CID#1237521
Zbigniew Jędrzejewski-Szmek 62fe94
---
Zbigniew Jędrzejewski-Szmek 62fe94
 src/test/test-fileio.c | 2 +-
Zbigniew Jędrzejewski-Szmek 62fe94
 1 file changed, 1 insertion(+), 1 deletion(-)
Zbigniew Jędrzejewski-Szmek 62fe94
Zbigniew Jędrzejewski-Szmek 62fe94
diff --git a/src/test/test-fileio.c b/src/test/test-fileio.c
Zbigniew Jędrzejewski-Szmek 62fe94
index e69706c3f8..92aa794a95 100644
Zbigniew Jędrzejewski-Szmek 62fe94
--- a/src/test/test-fileio.c
Zbigniew Jędrzejewski-Szmek 62fe94
+++ b/src/test/test-fileio.c
Zbigniew Jędrzejewski-Szmek 62fe94
@@ -325,7 +325,7 @@ static void test_write_string_file(void) {
Zbigniew Jędrzejewski-Szmek 62fe94
 
Zbigniew Jędrzejewski-Szmek 62fe94
         assert_se(write_string_file(fn, "boohoo") == 0);
Zbigniew Jędrzejewski-Szmek 62fe94
 
Zbigniew Jędrzejewski-Szmek 62fe94
-        assert_se(read(fd, buf, sizeof(buf)));
Zbigniew Jędrzejewski-Szmek 62fe94
+        assert_se(read(fd, buf, sizeof(buf)) == 7);
Zbigniew Jędrzejewski-Szmek 62fe94
         assert_se(streq(buf, "boohoo\n"));
Zbigniew Jędrzejewski-Szmek 62fe94
 
Zbigniew Jędrzejewski-Szmek 62fe94
         unlink(fn);