From 313734e050c391c13016befe7e57d3d5a87d778d Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Wed, 21 Mar 2018 19:18:40 +0000 Subject: [PATCH v3 1/3] Prevent division-by-zero errors in pg_resetwal. --- src/bin/pg_resetwal/pg_resetwal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/pg_resetwal/pg_resetwal.c b/src/bin/pg_resetwal/pg_resetwal.c index a132cf2..387ce51 100644 --- a/src/bin/pg_resetwal/pg_resetwal.c +++ b/src/bin/pg_resetwal/pg_resetwal.c @@ -601,7 +601,7 @@ ReadControlFile(void) fprintf(stderr, _("%s: pg_control specifies invalid WAL segment size (%d bytes); proceed with caution \n"), progname, WalSegSz); - guessed = true; + return false; } return true; @@ -679,7 +679,7 @@ GuessControlValues(void) ControlFile.blcksz = BLCKSZ; ControlFile.relseg_size = RELSEG_SIZE; ControlFile.xlog_blcksz = XLOG_BLCKSZ; - ControlFile.xlog_seg_size = DEFAULT_XLOG_SEG_SIZE; + WalSegSz = ControlFile.xlog_seg_size = DEFAULT_XLOG_SEG_SIZE; ControlFile.nameDataLen = NAMEDATALEN; ControlFile.indexMaxKeys = INDEX_MAX_KEYS; ControlFile.toast_max_chunk_size = TOAST_MAX_CHUNK_SIZE; -- 2.7.3.AMZN