aboutsummaryrefslogtreecommitdiff
path: root/bb.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-06-15 14:07:46 -0700
committerBruce Hill <bruce@bruce-hill.com>2019-06-15 14:07:46 -0700
commit1239060641b3a33eeefd7f72c3a53995916e01d8 (patch)
tree1316d3b892b07223c9e833e4acb504f6919fb5b6 /bb.c
parent5b1344db44a5caffd58a631ead7f7a3736d6bb90 (diff)
Fix for free-after-use caused by hardlinked files (reverting earlier
change that assumed files with equal inode/idev were the same)
Diffstat (limited to 'bb.c')
-rw-r--r--bb.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/bb.c b/bb.c
index 233c998..0d13f3f 100644
--- a/bb.c
+++ b/bb.c
@@ -752,7 +752,9 @@ entry_t* load_entry(bb_t *bb, const char *path)
// Check for pre-existing:
for (entry_t *e = bb->hash[(int)filestat.st_ino & HASH_MASK]; e; e = e->hash.next) {
- if (e->info.st_ino == filestat.st_ino && e->info.st_dev == filestat.st_dev)
+ if (e->info.st_ino == filestat.st_ino && e->info.st_dev == filestat.st_dev
+ // Need to check filename in case of hard links
+ && strcmp(pbuf, e->fullname) == 0)
return e;
}