Content-Length: 276724 | pFad | http://github.com/postgrespro/postgres/commit/cd83cb953606b94966981056e79dbb6c48751055

2D pg_waldump: Fix error message for WAL files smaller than XLOG_BLCKSZ. · postgrespro/postgres@cd83cb9 · GitHub
Skip to content

Commit cd83cb9

Browse files
committed
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 fc49e24
1 parent 73c61a5 commit cd83cb9

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/bin/pg_waldump/pg_waldump.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,15 +222,12 @@ search_directory(const char *directory, const char *fname)
222222
WalSegSz),
223223
fname, WalSegSz);
224224
}
225+
else if (r < 0)
226+
fatal_error("could not read file \"%s\": %m",
227+
fname);
225228
else
226-
{
227-
if (errno != 0)
228-
fatal_error("could not read file \"%s\": %m",
229-
fname);
230-
else
231-
fatal_error("could not read file \"%s\": read %d of %d",
232-
fname, r, XLOG_BLCKSZ);
233-
}
229+
fatal_error("could not read file \"%s\": read %d of %d",
230+
fname, r, XLOG_BLCKSZ);
234231
close(fd);
235232
return true;
236233
}

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/cd83cb953606b94966981056e79dbb6c48751055

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy