Fix assorted infelicities in new SetWALSegSize() function.

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 8485a25a8c9a419ff3e0d30e43e4abd5e680cc65
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2017-09-24T16:05:06Z
Releases: 11.0
Fix assorted infelicities in new SetWALSegSize() function.

* Failure to check for malloc failure (ok, pretty unlikely here, but
that's not an excuse).

* Leakage of open fd on read error, and of malloc'd buffer always.

* Incorrect assumption that a short read would set errno to zero.

* Failure to adhere to message style conventions (in particular,
not reporting errno where relevant; using "couldn't open" rather than
"could not open" is not really in line with project style either).

* Missing newlines on some messages.

Coverity spotted the leak problems; I noticed the rest while
fixing the leaks.

Files

PathChange+/−
contrib/pg_standby/pg_standby.c modified +14 −6