pg_waldump: Fix error message for WAL files smaller than XLOG_BLCKSZ.
authorAndres Freund <andres@anarazel.de>
Fri, 25 Feb 2022 18:40:32 +0000 (10:40 -0800)
committerAndres Freund <andres@anarazel.de>
Fri, 25 Feb 2022 18:40:32 +0000 (10:40 -0800)
commit51c34165614bde5d44a356ba5f1f4f79d8893103
tree25e1d08a828a54159a990a2c0fbbcbaab1888ece
parent3faa21bb761f52974cfc59dd9d3993f89d81f44e
pg_waldump: Fix error message for WAL files smaller than XLOG_BLCKSZ.

When opening a WAL file smaller than XLOG_BLCKSZ (e.g. 0 bytes long) while
determining the wal_segment_size, pg_waldump checked errno, despite errno not
being set by the short read. Resulting in a bogus error message.

Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/20220214.181847.775024684568733277.horikyota.ntt@gmail.com
Backpatch: 11-, the bug was introducedin fc49e24fa
src/bin/pg_waldump/pg_waldump.c