diff --git a/pkg.c b/pkg.c index 9c45301..b5498e8 100644 --- a/pkg.c +++ b/pkg.c @@ -289,11 +289,16 @@ pkg_scan_dir(const char *path, pkg_iteration_func_t func) static char filebuf[PKG_BUFSIZE]; pkg_t *pkg; FILE *f; + struct stat st; strlcpy(filebuf, path, sizeof filebuf); strlcat(filebuf, "/", sizeof filebuf); strlcat(filebuf, dirent->d_name, sizeof filebuf); + stat(filebuf, &st); + if (!(S_ISREG(st.st_mode))) + continue; + f = fopen(filebuf, "r"); if (f == NULL) continue; diff --git a/stdinc.h b/stdinc.h index cc35e57..f8a7537 100644 --- a/stdinc.h +++ b/stdinc.h @@ -24,6 +24,9 @@ #include #include #include +#include +#include +#include #ifdef _WIN32 # define WIN32_LEAN_AND_MEAN