]> granicus.if.org Git - postgresql/commit
Further tweaking of the readfile() function in pg_ctl.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 18 Oct 2012 19:26:26 +0000 (22:26 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 18 Oct 2012 19:30:55 +0000 (22:30 +0300)
commit8658c09ff6ca0d5e6f6078be15a1cfd44fb82674
tree5d3296e315d2732be0e27bec4f064c40c72adce8
parentc29a91037dcbc0a824a5bf17c2b2cd7e02e0692e
Further tweaking of the readfile() function in pg_ctl.

Don't leak a file descriptor if the file is empty or we can't read its size.

Expect there to be a newline at the end of the last line, too. If there
isn't, ignore anything after the last newline. This makes it a tiny bit
more robust in case the file is appended to concurrently, so that we don't
return the last line if it hasn't been fully written yet. And this makes
the code a bit less obscure, anyway. Per Tom Lane's suggestion.

Backpatch to all supported branches.
src/bin/pg_ctl/pg_ctl.c