1 |
commit: eddd1df90bc5d27e726c02e8aac8cfa9484ed3a8 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Dec 27 21:44:46 2019 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Dec 27 21:44:46 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=eddd1df9 |
7 |
|
8 |
qfile: make qfile_check_plibreg not trigger on an empty file (/) |
9 |
|
10 |
This really is an edge case, as result of a misinterpretation of the -R |
11 |
option. |
12 |
|
13 |
Bug: https://bugs.gentoo.org/699558 |
14 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
15 |
|
16 |
qfile.c | 4 ++-- |
17 |
1 file changed, 2 insertions(+), 2 deletions(-) |
18 |
|
19 |
diff --git a/qfile.c b/qfile.c |
20 |
index 6c2ebb8..b1aab8d 100644 |
21 |
--- a/qfile.c |
22 |
+++ b/qfile.c |
23 |
@@ -119,7 +119,7 @@ static int qfile_check_plibreg(void *priv) |
24 |
} |
25 |
|
26 |
for (i = 0; i < args->length; i++) { |
27 |
- if (base_names[i] == NULL) |
28 |
+ if (base_names[i] == NULL || base_names[i][0] == '\0') |
29 |
continue; |
30 |
if (non_orphans && non_orphans[i]) |
31 |
continue; |
32 |
@@ -534,7 +534,7 @@ int qfile_main(int argc, char **argv) |
33 |
* (this one is just for qfile(...) output) */ |
34 |
size_t lastc = strlen(portroot) - 1; |
35 |
state.root = xstrdup(portroot); |
36 |
- if (state.root[lastc] == '/') |
37 |
+ if (lastc > 0 && state.root[lastc] == '/') |
38 |
state.root[lastc] = '\0'; |
39 |
} |