From 7618f255df3b2d1a045d2fe7fd2dcbee420dfe66 Mon Sep 17 00:00:00 2001 From: Michael Banck Date: Tue, 28 Aug 2018 17:27:20 +0200 Subject: [PATCH] Check block size from PGDATA against compiled in BLCKSZ and abort on mismatch. --- pg_checksums.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pg_checksums.c b/pg_checksums.c index 9543b43..138db86 100644 --- a/pg_checksums.c +++ b/pg_checksums.c @@ -797,6 +797,17 @@ main(int argc, char *argv[]) exit(1); } + /* + * Check that the PGDATA blocksize is the same as the one pg_checksums + * was compiled against (BLCKSZ). + */ + if (ControlFile->blcksz != BLCKSZ) + { + fprintf(stderr, _("%s: data directory block size %d is different to compiled-in block size %d.\n"), + progname, ControlFile->blcksz, BLCKSZ); + exit(1); + } + if (activate || verify) { #if PG_VERSION_NUM < 100000