summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-03-13 00:19:41 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-03-13 00:19:41 +0000
commitf48b18df43670d0535b084ff7fcfa15a6113165b (patch)
treeffbfd6630de0b435943e1bda2e3ebabbe59d5488
parenta3bb1f886e213bddbeb2215596d8656be7916b93 (diff)
downloadmandoc-f48b18df43670d0535b084ff7fcfa15a6113165b.tar.gz
Fix hardlink detection on platforms having padding in struct inodev,
typically 64bit platforms. This was basically broken since forever. Not only is the padding used, but it was used uninitialized. Problem reported by jmc@.
-rw-r--r--mandocdb.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/mandocdb.c b/mandocdb.c
index f9af88d0..f98fa8e5 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -942,6 +942,7 @@ mlink_add(struct mlink *mlink, const struct stat *st)
assert(NULL == ohash_find(&mlinks, slot));
ohash_insert(&mlinks, slot, mlink);
+ memset(&inodev, 0, sizeof(inodev)); /* Clear padding. */
inodev.st_ino = st->st_ino;
inodev.st_dev = st->st_dev;
slot = ohash_lookup_memory(&mpages, (char *)&inodev,