From e5f3dac6e7e6835104242a881a6c7768b3024133 Mon Sep 17 00:00:00 2001 From: William Pitcock Date: Sun, 22 Jan 2017 23:07:39 -0600 Subject: [PATCH] libpkgconf: pkg: handle error value from stat(2). --- libpkgconf/pkg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libpkgconf/pkg.c b/libpkgconf/pkg.c index 89f13c5..e2007f7 100644 --- a/libpkgconf/pkg.c +++ b/libpkgconf/pkg.c @@ -452,7 +452,9 @@ pkgconf_pkg_scan_dir(pkgconf_client_t *client, const char *path, void *data, pkg pkgconf_strlcat(filebuf, "/", sizeof filebuf); pkgconf_strlcat(filebuf, dirent->d_name, sizeof filebuf); - stat(filebuf, &st); + if (stat(filebuf, &st) == -1) + continue; + if (!(S_ISREG(st.st_mode))) continue;