Fix pg_ctl's readfile() to not go into infinite loop on an empty file
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 2 Sep 2009 02:40:52 +0000 (02:40 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 2 Sep 2009 02:40:52 +0000 (02:40 +0000)
commit5e57196ce27e2d2b9de49d8e60a063617bec5e46
treed04a02ce5e491603fc0ae052b7c11ae1eafe181d
parent1a7bbfe645b8379e368ec9969f99fee455e3ecf3
Fix pg_ctl's readfile() to not go into infinite loop on an empty file
(could happen if either postgresql.conf or postmaster.opts is empty).
It's been broken since the C version was written for 8.0, so patch
all the way back.

initdb's copy of the function is broken in the same way, but it's
less important there since the input files should never be empty.
Patch that in HEAD only, and also fix some cosmetic differences that
crept into that copy of the function.

Per report from Corry Haines and Jeff Davis.
src/bin/initdb/initdb.c
src/bin/pg_ctl/pg_ctl.c