]> granicus.if.org Git - postgresql/commit
When performing a base backup, check for read errors.
authorRobert Haas <rhaas@postgresql.org>
Fri, 6 Sep 2019 12:22:32 +0000 (08:22 -0400)
committerRobert Haas <rhaas@postgresql.org>
Fri, 6 Sep 2019 13:01:45 +0000 (09:01 -0400)
commit23df8822601dce04d259fed0326ef28ecc6d1fa0
tree29e2831e24be79f7746675f154c24e1e859457f5
parentf4b91a50e9e6757679322c454916bcd6b1dcbc15
When performing a base backup, check for read errors.

The old code didn't differentiate between a read error and a
concurrent truncation. fread reports both of these by returning 0;
you have to use feof() or ferror() to distinguish between them,
which this code did not do.

It might be a better idea to use read() rather than fread() here,
so that we can display a less-generic error message, but I'm not
sure that would qualify as a back-patchable bug fix, so just do
this much for now.

Jeevan Chalke, reviewed by Jeevan Ladhe and by me.

Discussion: http://postgr.es/m/CA+TgmobG4ywMzL5oQq2a8YKp8x2p3p1LOMMcGqpS7aekT9+ETA@mail.gmail.com
src/backend/replication/basebackup.c