commit:     4176ede48eabc7fce958d6d9c5d22154fe122447
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Apr 18 13:57:51 2018 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Apr 18 13:57:51 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=4176ede4

qcache: make categories counting work properly

 qcache.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/qcache.c b/qcache.c
index 03bcd05..a3be446 100644
--- a/qcache.c
+++ b/qcache.c
@@ -747,23 +747,24 @@ qcache_stats(qcache_data *data)
 
                runtime = time(NULL);
 
-               xasprintf(&catpath, "%s/dep/%s", portedb, data->overlay);
+               xasprintf(&catpath, "%s/metadata/md5-cache", data->overlay);
                dir = opendir(catpath);
                while ((de = readdir(dir))) {
                        /* Look for all the directories in this path. */
-#ifdef DT_UNKNOWN
+#if defined(DT_UNKNOWN) && defined(DT_DIR)
                        if (de->d_type == DT_UNKNOWN)
 #endif
                        {
                                struct stat s;
-                               if (lstat(de->d_name, &s))
+                               char spath[_Q_PATH_MAX];
+                               snprintf(spath, sizeof(spath), "%s/%s", 
catpath, de->d_name);
+                               if (lstat(spath, &s) != 0)
                                        continue;
                                if (!S_ISDIR(s.st_mode))
                                        continue;
                        }
-
-#ifdef DT_DIR
-                       if (de->d_type != DT_DIR)
+#if defined(DT_UNKNOWN) && defined(DT_DIR)
+                       else if (de->d_type != DT_DIR)
                                continue;
 #endif
 

Reply via email to