arrfab / rpms / libreport

Forked from rpms/libreport 5 years ago
Clone

Blame SOURCES/0008-coverity-fixes-def16-def17.patch

91b162
From a6cc1ba3c528c2622d229decbc59944f8ef5752a Mon Sep 17 00:00:00 2001
91b162
From: Matej Habrnal <mhabrnal@redhat.com>
91b162
Date: Fri, 20 Jul 2018 15:39:13 +0200
91b162
Subject: [PATCH] coverity fixes [#def16] [#def17]
91b162
91b162
libreport-2.9.5/src/lib/dump_dir.c:890: negative_returns: "fd" is passed to a
91b162
parameter that cannot be negative.
91b162
91b162
https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libreport-2.9.5-2.el8+7/scan-results.html#def16
91b162
91b162
libreport-2.9.5/src/lib/dump_dir.c:926: negative_returns: "fd" is passed to a parameter that cannot be negative.
91b162
91b162
https://cov01.lab.eng.brq.redhat.com/el8-results/el8/libreport-2.9.5-2.el8+7/scan-results.html#def17
91b162
91b162
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
91b162
---
91b162
 src/lib/dump_dir.c | 6 ++++--
91b162
 1 file changed, 4 insertions(+), 2 deletions(-)
91b162
91b162
diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c
91b162
index f509fdc5..632a01fa 100644
91b162
--- a/src/lib/dump_dir.c
91b162
+++ b/src/lib/dump_dir.c
91b162
@@ -849,10 +849,12 @@ static int fdreopen(int dir_fd, DIR **d)
91b162
     { \
91b162
         if (dot_or_dotdot(dent->d_name)) continue; \
91b162
         int fd = secure_openat_read(dirfd(d), dent->d_name); \
91b162
-        if (fd >= 0)
91b162
+        if (fd >= 0) \
91b162
+        {
91b162
 
91b162
 #define FOREACH_REGULAR_FILE_AS_FD_AT_END \
91b162
-        close(fd); \
91b162
+            close(fd); \
91b162
+        } \
91b162
     } \
91b162
     closedir(d);
91b162
 
91b162
-- 
91b162
2.17.1
91b162