Fix for free-after-use caused by hardlinked files (reverting earlier

change that assumed files with equal inode/idev were the same)
This commit is contained in:
Bruce Hill 2019-06-15 14:07:46 -07:00
parent 5b1344db44
commit 1239060641

4
bb.c
View File

@ -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;
}