libpkgconf: path: check both device node and inode for dedup. pointed out by @plicease

pull/109/head
William Pitcock 2016-12-30 11:39:45 -06:00
parent 92f2b4a2e0
commit 92f566ff38
2 changed files with 5 additions and 3 deletions

View File

@ -92,7 +92,8 @@ struct pkgconf_path_ {
pkgconf_node_t lnode;
char *path;
void *handle;
void *handle_path;
void *handle_device;
};
#define PKGCONF_PKG_PROPF_NONE 0x0

View File

@ -35,7 +35,7 @@ path_list_contains_entry(const char *text, pkgconf_list_t *dirlist)
pkgconf_path_t *pn = n->data;
#ifdef PKGCONF_CACHE_INODES
if (((ino_t) pn->handle) == st->st_ino)
if (((dev_t) pn->handle_device) == st->st_dev && ((ino_t) pn->handle_path) == st->st_ino)
return true;
#endif
@ -89,7 +89,8 @@ pkgconf_path_add(const char *text, pkgconf_list_t *dirlist, bool filter)
node = calloc(sizeof(pkgconf_path_t), 1);
node->path = strdup(text);
#ifdef PKGCONF_CACHE_INODES
node->handle = (void *)(intptr_t) st.st_ino;
node->handle_path = (void *)(intptr_t) st.st_ino;
node->handle_device = (void *)(intptr_t) st.st_dev;
#endif
pkgconf_node_insert_tail(&node->lnode, node, dirlist);