]> granicus.if.org Git - postgresql/commit
Fix assorted inconsistencies in our calls of readlink().
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 28 May 2015 16:17:22 +0000 (12:17 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 28 May 2015 16:17:22 +0000 (12:17 -0400)
commit32f628be74d8ab43423ca7913b81f7eb21b312d4
treede18887a837b733cac8be12996602da9ce869247
parentf46edf479e2468a08caca2a03ec7e258930a7161
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
src/backend/replication/basebackup.c
src/backend/storage/file/fd.c
src/backend/utils/adt/misc.c
src/bin/pg_rewind/copy_fetch.c