commit: eddd1df90bc5d27e726c02e8aac8cfa9484ed3a8 Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> AuthorDate: Fri Dec 27 21:44:46 2019 +0000 Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> CommitDate: Fri Dec 27 21:44:46 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=eddd1df9
qfile: make qfile_check_plibreg not trigger on an empty file (/) This really is an edge case, as result of a misinterpretation of the -R option. Bug: https://bugs.gentoo.org/699558 Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> qfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qfile.c b/qfile.c index 6c2ebb8..b1aab8d 100644 --- a/qfile.c +++ b/qfile.c @@ -119,7 +119,7 @@ static int qfile_check_plibreg(void *priv) } for (i = 0; i < args->length; i++) { - if (base_names[i] == NULL) + if (base_names[i] == NULL || base_names[i][0] == '\0') continue; if (non_orphans && non_orphans[i]) continue; @@ -534,7 +534,7 @@ int qfile_main(int argc, char **argv) * (this one is just for qfile(...) output) */ size_t lastc = strlen(portroot) - 1; state.root = xstrdup(portroot); - if (state.root[lastc] == '/') + if (lastc > 0 && state.root[lastc] == '/') state.root[lastc] = '\0'; }
