mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-06 14:19:20 +02:00
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
This commit is contained in:
parent
0033fc63f5
commit
5407241a8e
@ -207,15 +207,12 @@ search_directory(const char *directory, const char *fname)
|
|||||||
WalSegSz),
|
WalSegSz),
|
||||||
fname, WalSegSz);
|
fname, WalSegSz);
|
||||||
}
|
}
|
||||||
else
|
else if (r < 0)
|
||||||
{
|
|
||||||
if (errno != 0)
|
|
||||||
fatal_error("could not read file \"%s\": %s",
|
fatal_error("could not read file \"%s\": %s",
|
||||||
fname, strerror(errno));
|
fname, strerror(errno));
|
||||||
else
|
else
|
||||||
fatal_error("could not read file \"%s\": read %d of %zu",
|
fatal_error("could not read file \"%s\": read %d of %zu",
|
||||||
fname, r, (Size) XLOG_BLCKSZ);
|
fname, r, (Size) XLOG_BLCKSZ);
|
||||||
}
|
|
||||||
close(fd);
|
close(fd);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user