pgsql: Fix assorted inconsistencies in our calls of readlink().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix assorted inconsistencies in our calls of readlink().
Date: 2015-05-28 16:17:28
Message-ID: E1Yy0Uq-0004O1-6f@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix assorted inconsistencies in our calls of readlink().

Ensure that we null-terminate the result string (one place in pg_rewind).
Be paranoid about out-of-range results from readlink() (should not happen,
but there is no good reason for some call sites to be careful about it and
others not). Consistently use the whole buffer, not sometimes one byte
less. Ensure we emit an appropriate errcode() in all cases. Spell the
error messages the same way.

The only serious bug here is the missing null-termination in pg_rewind,
which is new code, so no need for a back-patch.

Abhijit Menon-Sen and Tom Lane

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/32f628be74d8ab43423ca7913b81f7eb21b312d4

Modified Files
--------------
src/backend/replication/basebackup.c | 3 ++-
src/backend/storage/file/fd.c | 9 ++++-----
src/backend/utils/adt/misc.c | 8 +++++---
src/bin/pg_rewind/copy_fetch.c | 17 +++++++----------
4 files changed, 18 insertions(+), 19 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Stephen Frost 2015-05-28 16:41:37 pgsql: Remove pg_audit
Previous Message Tom Lane 2015-05-28 15:24:49 pgsql: Fix pg_get_functiondef() to print a function's LEAKPROOF propert