From 2e855972dc9dbbae8e290e7432d559426f4af8e9 Mon Sep 17 00:00:00 2001 From: Baptiste Daroussin Date: Sat, 7 Jan 2017 17:52:44 +0100 Subject: [PATCH] inode cache: ensure we never use an unitilized struct stat --- libpkgconf/path.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libpkgconf/path.c b/libpkgconf/path.c index c2d7093..beaacbc 100644 --- a/libpkgconf/path.c +++ b/libpkgconf/path.c @@ -89,8 +89,10 @@ 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_path = (void *)(intptr_t) st.st_ino; - node->handle_device = (void *)(intptr_t) st.st_dev; + if (filter) { + 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);