commit: 46aea99b4b973d29db4f717fa72bcf3e1cb80f22 Author: Mike Frysinger <vapier <AT> gentoo <DOT> org> AuthorDate: Fri Apr 1 21:40:11 2016 +0000 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org> CommitDate: Fri Apr 1 21:40:11 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=46aea99b
qsearch: fix dirname/basename calls Since dirname might modify its argument, make sure we call basename first so we don't end up with the dirname twice. URL: https://bugs.gentoo.org/578758 Reported-by: Kolbjørn Barmen <gentoo <AT> kolla.no> qsearch.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qsearch.c b/qsearch.c index e23642b..1ebfccf 100644 --- a/qsearch.c +++ b/qsearch.c @@ -119,8 +119,9 @@ qsearch_ebuild_ebuild(int overlay_fd, const char *ebuild, const char *search_me, } if (show_it) { + const char *pkg = basename(p); printf("%s%s/%s%s%s %s\n", - BOLD, dirname(p), BLUE, basename(p), NORM, + BOLD, dirname(p), BLUE, pkg, NORM, (show_name_only ? "" : q ? : "<no DESCRIPTION found>")); }