pgsql: Further tweaking of the readfile() function in pg_ctl.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Further tweaking of the readfile() function in pg_ctl.
Date: 2012-10-18 19:34:26
Message-ID: E1TOvrO-0006Bu-TV@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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.

Branch
------
REL8_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/8658c09ff6ca0d5e6f6078be15a1cfd44fb82674

Modified Files
--------------
src/bin/pg_ctl/pg_ctl.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andrew Dunstan 2012-10-18 20:16:07 pgsql: Use a more portable platform test.
Previous Message Simon Riggs 2012-10-18 18:44:47 pgsql: Isolation test for DROP INDEX CONCURRENTLY