libpkgconf: move sys/stat.h inclusion out of stdinc.h to the only other consumer of sys/stat.h

pull/116/head
William Pitcock 2017-01-22 23:09:38 -06:00
parent e5f3dac6e7
commit 9ece7cd487
2 changed files with 8 additions and 1 deletions

View File

@ -16,6 +16,10 @@
#include <libpkgconf/config.h>
#include <libpkgconf/libpkgconf.h>
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif
/*
* !doc
*
@ -446,17 +450,21 @@ pkgconf_pkg_scan_dir(pkgconf_client_t *client, const char *path, void *data, pkg
static char filebuf[PKGCONF_BUFSIZE];
pkgconf_pkg_t *pkg;
FILE *f;
#ifdef HAVE_SYS_STAT_H
struct stat st;
#endif
pkgconf_strlcpy(filebuf, path, sizeof filebuf);
pkgconf_strlcat(filebuf, "/", sizeof filebuf);
pkgconf_strlcat(filebuf, dirent->d_name, sizeof filebuf);
#ifdef HAVE_SYS_STAT_H
if (stat(filebuf, &st) == -1)
continue;
if (!(S_ISREG(st.st_mode)))
continue;
#endif
f = fopen(filebuf, "r");
if (f == NULL)

View File

@ -26,7 +26,6 @@
#include <string.h>
#include <dirent.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdint.h>