1 |
commit: bdda53e4e914c44b1c278c6df1e726ba5170cff0 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Jan 22 20:09:07 2020 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Jan 22 20:09:07 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=bdda53e4 |
7 |
|
8 |
qmanifest: fix Coverity 206535 Unchecked return value |
9 |
|
10 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
11 |
|
12 |
qmanifest.c | 6 +++++- |
13 |
1 file changed, 5 insertions(+), 1 deletion(-) |
14 |
|
15 |
diff --git a/qmanifest.c b/qmanifest.c |
16 |
index 31c4696..b4057bb 100644 |
17 |
--- a/qmanifest.c |
18 |
+++ b/qmanifest.c |
19 |
@@ -690,7 +690,11 @@ generate_dir(const char *dir, enum type_manifest mtype) |
20 |
fclose(m); |
21 |
|
22 |
snprintf(path, sizeof(path), "%s/%s", dir, str_manifest); |
23 |
- rename(newmanifest, path); |
24 |
+ if (rename(newmanifest, path) == -1) { |
25 |
+ fprintf(stderr, "failed to rename file '%s' to '%s': %s\n", |
26 |
+ newmanifest, path, strerror(errno)); |
27 |
+ return NULL; |
28 |
+ } |
29 |
|
30 |
if (tv[0].tv_sec != 0) { |
31 |
/* set Manifest and dir mtime to most recent file we found */ |