arrfab / rpms / libreport

Forked from rpms/libreport 5 years ago
Clone

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

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