libpkgconf: path: check both device node and inode for dedup. pointed out by @plicease
parent
92f2b4a2e0
commit
92f566ff38
|
@ -92,7 +92,8 @@ struct pkgconf_path_ {
|
||||||
pkgconf_node_t lnode;
|
pkgconf_node_t lnode;
|
||||||
|
|
||||||
char *path;
|
char *path;
|
||||||
void *handle;
|
void *handle_path;
|
||||||
|
void *handle_device;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PKGCONF_PKG_PROPF_NONE 0x0
|
#define PKGCONF_PKG_PROPF_NONE 0x0
|
||||||
|
|
|
@ -35,7 +35,7 @@ path_list_contains_entry(const char *text, pkgconf_list_t *dirlist)
|
||||||
pkgconf_path_t *pn = n->data;
|
pkgconf_path_t *pn = n->data;
|
||||||
|
|
||||||
#ifdef PKGCONF_CACHE_INODES
|
#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;
|
return true;
|
||||||
#endif
|
#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 = calloc(sizeof(pkgconf_path_t), 1);
|
||||||
node->path = strdup(text);
|
node->path = strdup(text);
|
||||||
#ifdef PKGCONF_CACHE_INODES
|
#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
|
#endif
|
||||||
|
|
||||||
pkgconf_node_insert_tail(&node->lnode, node, dirlist);
|
pkgconf_node_insert_tail(&node->lnode, node, dirlist);
|
||||||
|
|
Loading…
Reference in New Issue