]> git.ipfire.org Git - thirdparty/postgresql.git/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:42 +0000 (22:30 +0300)
commitd2a5f326568dfe98559319db6f3b9d08f0c851cc
tree4f1c6519a687c0a574f76a2054cbea3322a72712
parent447dad7193721f757dddf7c409b0b75aa2b5fb98
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