dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone
Blob Blame History Raw
From 38b3bd9bde495d44283de2b837ab0239140edb3d Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn@redhat.com>
Date: Fri, 22 Jul 2016 09:53:40 +0200
Subject: [PATCH 32/44] SECRETS: Log message for failures with removing file
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Type: Unchecked return value
Reported by coverity

Reviewed-by: Petr Čech <pcech@redhat.com>
---
 src/responder/secrets/local.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/responder/secrets/local.c b/src/responder/secrets/local.c
index 620134ea6b45629114ba795d0e232f414f6e5009..2a85ac06945322265fbd1012c9697728c37b77a0 100644
--- a/src/responder/secrets/local.c
+++ b/src/responder/secrets/local.c
@@ -624,7 +624,13 @@ int generate_master_key(const char *filename, size_t size)
     rsize = sss_atomic_io_s(fd, buf, size, false);
     close(fd);
     if (rsize != size) {
-        unlink(filename);
+        ret = unlink(filename);
+        /* non-fatal failure */
+        if (ret != EOK) {
+            DEBUG(SSSDBG_MINOR_FAILURE,
+                  "Failed to remove file: %s - %d [%s]!\n",
+                  filename, ret, sss_strerror(ret));
+        }
         return EFAULT;
     }
 
-- 
2.4.11