forked from ariadne/pkgconf
libpkgconf: move sys/stat.h inclusion out of stdinc.h to the only other consumer of sys/stat.h
parent
e5f3dac6e7
commit
9ece7cd487
|
@ -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)
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue