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