commit:     74219ab70d2a5bcad327c3795f5fa9b881d433ad
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 17 08:35:39 2019 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Aug 17 08:35:39 2019 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=74219ab7

qlop: add ROOT support, bug #692224

Respect ROOT when set, to ease scripting of qlop interaction with
chroots.

Bug: https://bugs.gentoo.org/692224
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 qlop.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/qlop.c b/qlop.c
index fce0f69..7acb855 100644
--- a/qlop.c
+++ b/qlop.c
@@ -351,7 +351,14 @@ static int do_emerge_log(
        struct pkg_match *pkg;
        struct pkg_match *pkgw;
 
-       if ((fp = fopen(log, "r")) == NULL) {
+       /* support relative path in here and now, when using ROOT, stick to
+        * it, turning relative into a moot point */
+       if (portroot[1] == '\0')
+               snprintf(buf, sizeof(buf), "%s", log);
+       else
+               snprintf(buf, sizeof(buf), "%s%s", portroot, log);
+       if ((fp = fopen(buf, "r")) == NULL)
+       {
                warnp("Could not open logfile '%s'", log);
                return 1;
        }

Reply via email to