From: Heikki Linnakangas Date: Sun, 4 Jan 2026 18:04:36 +0000 (+0200) Subject: Fix partial read handling in pg_upgrade's multixact conversion X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ac94ce8194e501c1ace7115e5e4720e0da4b5168;p=thirdparty%2Fpostgresql.git Fix partial read handling in pg_upgrade's multixact conversion Author: Man Zeng Discussion: https://www.postgresql.org/message-id/tencent_566562B52163DB1502F4F7A4@qq.com --- diff --git a/src/bin/pg_upgrade/slru_io.c b/src/bin/pg_upgrade/slru_io.c index adb3e11ab2e..ae3e224d7b1 100644 --- a/src/bin/pg_upgrade/slru_io.c +++ b/src/bin/pg_upgrade/slru_io.c @@ -121,7 +121,7 @@ SlruReadSwitchPageSlow(SlruSegState *state, uint64 pageno) ssize_t rc; rc = pg_pread(state->fd, - &state->buf.data + bytes_read, + &state->buf.data[bytes_read], BLCKSZ - bytes_read, offset); if (rc < 0) @@ -135,7 +135,7 @@ SlruReadSwitchPageSlow(SlruSegState *state, uint64 pageno) /* unexpected EOF */ pg_log(PG_WARNING, "unexpected EOF reading file \"%s\" at offset %u, reading as zeros", state->fn, (unsigned int) offset); - memset(&state->buf.data + bytes_read, 0, BLCKSZ - bytes_read); + memset(&state->buf.data[bytes_read], 0, BLCKSZ - bytes_read); break; } bytes_read += rc;