forked from ariadne/pkgconf
pkg: call stat(2) in scan function
parent
84cb26ef6c
commit
1789daacb4
5
pkg.c
5
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;
|
||||
|
|
Loading…
Reference in New Issue