commit:     6f159efc1ab01535a1857e93f9180b71d8016f75
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu May 30 08:50:22 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu May 30 08:55:08 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=6f159efc

qfile: fix regression introduced in 55ad84ae

inversion of assume_root_prefix lead to unusable qfile with ROOT

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 d321a59..421c850 100644
--- a/qfile.c
+++ b/qfile.c
@@ -137,7 +137,7 @@ static int qfile_cb(tree_pkg_ctx *pkg_ctx, void *priv)
                for (i = 0; i < args->length; i++) {
                        if (base_names[i] == NULL)
                                continue;
-                       if (non_orphans && non_orphans[i])
+                       if (non_orphans != NULL && non_orphans[i])
                                continue;
 
                        /* For optimization of qfile(), we also give it an 
array of
@@ -316,7 +316,7 @@ prepare_qfile_args(const int argc, const char **argv, 
struct qfile_opt_state *st
                 * "realpath(ROOT)" prefix) */
                if (argv[i][0] == '/') {
                        snprintf(abspath, sizeof(abspath), "%s%s",
-                                       state->assume_root_prefix ? real_root : 
"", argv[i]);
+                                       state->assume_root_prefix ? "" : 
real_root, argv[i]);
                } else if (pwd) {
                        if (state->assume_root_prefix)
                                snprintf(abspath, sizeof(abspath), "%s/%s", 
pwd, argv[i]);

Reply via email to