Gentoo Archives: gentoo-commits

From: Fabian Groffen <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage-utils:master commit in: /
Date: Wed, 16 Jun 2021 19:21:54
Message-Id: 1623871183.860ace7e297f4f79b1cd52c7bbee48a5a1ed78ce.grobian@gentoo
1 commit: 860ace7e297f4f79b1cd52c7bbee48a5a1ed78ce
2 Author: Joakim Tjernlund <joakim.tjernlund <AT> infinera <DOT> com>
3 AuthorDate: Wed Jun 16 14:43:11 2021 +0000
4 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
5 CommitDate: Wed Jun 16 19:19:43 2021 +0000
6 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=860ace7e
7
8 qmerge: Protect against NULL ptr
9
10 hash will be NULL if file does not exist.
11
12 Signed-off-by: Joakim Tjernlund <joakim.tjernlund <AT> infinera.com>
13 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
14
15 qmerge.c | 4 +++-
16 1 file changed, 3 insertions(+), 1 deletion(-)
17
18 diff --git a/qmerge.c b/qmerge.c
19 index 2e8730e..7b42956 100644
20 --- a/qmerge.c
21 +++ b/qmerge.c
22 @@ -1513,7 +1513,9 @@ pkg_unmerge(tree_pkg_ctx *pkg_ctx, set *keep,
23 /* If the file wasn't modified, unmerge it */
24 char *hash = hash_file_at(portroot_fd,
25 e->name + 1, HASH_MD5);
26 - protected = strcmp(e->digest, (const char *)hash);
27 + protected = 0;
28 + if (hash)
29 + protected = strcmp(e->digest, (const char *)hash);
30 }
31 break;