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

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

View File

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