forked from ariadne/pkgconf
If PKG_CONFIG_PATH element is a sym link, use the link destination instead of the link for inode caching checks.
See issue 112 & issue 110 (https://github.com/pkgconf/pkgconf/issues)feature/tap-sh
parent
76b8e0a26b
commit
9b255d465c
|
@ -82,11 +82,22 @@ pkgconf_path_add(const char *text, pkgconf_list_t *dirlist, bool filter)
|
||||||
#ifdef PKGCONF_CACHE_INODES
|
#ifdef PKGCONF_CACHE_INODES
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
if (filter && stat(text, &st) == -1)
|
if (filter)
|
||||||
return;
|
{
|
||||||
|
if (lstat(text, &st) == -1)
|
||||||
|
return;
|
||||||
|
if (S_ISLNK(st.st_mode))
|
||||||
|
{
|
||||||
|
char linkdest[PKGCONF_BUFSIZE];
|
||||||
|
ssize_t len = readlink(text, linkdest, sizeof(linkdest));
|
||||||
|
|
||||||
if (filter && path_list_contains_entry(text, dirlist, &st))
|
if (len != -1 && (size_t)len < sizeof(linkdest) &&
|
||||||
return;
|
stat(linkdest, &st) == -1)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (path_list_contains_entry(text, dirlist, &st))
|
||||||
|
return;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
if (filter && path_list_contains_entry(text, dirlist))
|
if (filter && path_list_contains_entry(text, dirlist))
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue