From 64acb4e4b98d7abe7436d83f0d64f0a3238fe5f3 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 1 Sep 2015 19:04:57 +0200 Subject: dpkg: Fix --verify with --root The code was not taking into account the root prefix when verifying pathnames, which resulted in all files failing to verify. --- src/verify.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/verify.c b/src/verify.c index 28fa84682..e2d087217 100644 --- a/src/verify.c +++ b/src/verify.c @@ -96,6 +96,7 @@ static void verify_package(struct pkginfo *pkg) { struct fileinlist *file; + struct varbuf filename = VARBUF_INIT; ensure_packagefiles_available(pkg); parse_filehash(pkg, &pkg->installed); @@ -116,9 +117,14 @@ verify_package(struct pkginfo *pkg) fnn->newhash = fnn->oldhash; } + varbuf_reset(&filename); + varbuf_add_str(&filename, instdir); + varbuf_add_str(&filename, fnn->name); + varbuf_end_str(&filename); + memset(&checks, 0, sizeof(checks)); - md5hash(pkg, hash, fnn->name); + md5hash(pkg, hash, filename.buf); if (strcmp(hash, fnn->newhash) != 0) { checks.md5sum = VERIFY_FAIL; failures++; -- cgit v1.2.3