commit:     29afc5efc0ae2cd9977b0b44469d741c1c2066d3
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 27 20:49:47 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Nov 27 20:49:47 2015 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=29afc5ef

qcache: fix ebuild traversal error path

We were freeing the wrong vars for this loop.

Also do not dump a warning when we try to scan a path that isn't a
directory.  Random files in there shouldn't cause us to complain.

 qcache.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/qcache.c b/qcache.c
index af64bc5..8dbeaa3 100644
--- a/qcache.c
+++ b/qcache.c
@@ -441,9 +441,11 @@ int qcache_traverse(void (*func)(qcache_data*))
                        xasprintf(&ebuildpath, "%s/%s/%s", portdir, 
categories[i]->d_name, packages[j]->d_name);
 
                        if (-1 == (num_ebuild = scandir(ebuildpath, &ebuilds, 
qcache_ebuild_select, qcache_vercmp))) {
-                               warnp("%s", ebuildpath);
-                               free(packages[i]);
-                               free(pkgpath);
+                               /* Do not complain about spurious files */
+                               if (errno != ENOTDIR)
+                                       warnp("%s", ebuildpath);
+                               free(packages[j]);
+                               free(ebuildpath);
                                continue;
                        }
 

Reply via email to