aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandocdb.c
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
commitda19f83a0a1e7d90a16cdddde0cfc118f0f2856e (patch)
tree059dc311d89273c46f9242606342e141c298a797 /mandocdb.c
parentfbdab4dd620059bb1b92e6ece99e796d62affbd6 (diff)
downloadmandoc-da19f83a0a1e7d90a16cdddde0cfc118f0f2856e.tar.gz
mandoc-da19f83a0a1e7d90a16cdddde0cfc118f0f2856e.tar.zst
mandoc-da19f83a0a1e7d90a16cdddde0cfc118f0f2856e.zip
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@.
Diffstat (limited to 'mandocdb.c')
-rw-r--r--mandocdb.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mandocdb.c b/mandocdb.c
index 9270e5cd..fed11e9f 100644
--- a/mandocdb.c
+++ b/mandocdb.c
@@ -1,4 +1,4 @@
-/* $Id: mandocdb.c,v 1.185 2015/02/27 16:22:09 schwarze Exp $ */
+/* $Id: mandocdb.c,v 1.186 2015/03/13 00:19:41 schwarze Exp $ */
/*
* Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -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,