commit: 7c64d59b55c1681a022f7b774590f512d35782c2
Author: Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 4 15:45:40 2016 +0000
Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Mon Apr 4 15:45:40 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=7c64d59b
repos.conf: fix fallback logic
Invert the S_ISREG check so we don't ignore regular files, and avoid
leaking the path buffer when we do skip the non-regular files.
Reported-by: consus <AT> gmx.com
main.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/main.c b/main.c
index 8e6d4fd..e9e65b4 100644
--- a/main.c
+++ b/main.c
@@ -507,8 +507,10 @@ static void read_repos_conf(const char *configroot, const
char *repos_conf)
#endif
{
struct stat st;
- if (stat(sub_conf, &st) || S_ISREG(st.st_mode))
+ if (stat(sub_conf, &st) ||
!S_ISREG(st.st_mode)) {
+ free(sub_conf);
continue;
+ }
}
read_one_repos_conf(sub_conf);