commit:     bdda53e4e914c44b1c278c6df1e726ba5170cff0
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Jan 22 20:09:07 2020 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Jan 22 20:09:07 2020 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=bdda53e4

qmanifest: fix Coverity 206535 Unchecked return value

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 qmanifest.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/qmanifest.c b/qmanifest.c
index 31c4696..b4057bb 100644
--- a/qmanifest.c
+++ b/qmanifest.c
@@ -690,7 +690,11 @@ generate_dir(const char *dir, enum type_manifest mtype)
                fclose(m);
 
                snprintf(path, sizeof(path), "%s/%s", dir, str_manifest);
-               rename(newmanifest, path);
+               if (rename(newmanifest, path) == -1) {
+                       fprintf(stderr, "failed to rename file '%s' to '%s': 
%s\n",
+                                       newmanifest, path, strerror(errno));
+                       return NULL;
+               }
 
                if (tv[0].tv_sec != 0) {
                        /* set Manifest and dir mtime to most recent file we 
found */

Reply via email to