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.
This commit is contained in:
parent
d40ef0dc0b
commit
bcdb578895
@ -4,7 +4,7 @@
|
||||
*
|
||||
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.92.2.6 2009/01/28 11:19:40 mha Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.92.2.7 2009/09/02 02:41:07 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -299,7 +299,7 @@ static char **
|
||||
readfile(const char *path)
|
||||
{
|
||||
FILE *infile;
|
||||
int maxlength = 0,
|
||||
int maxlength = 1,
|
||||
linelen = 0;
|
||||
int nlines = 0;
|
||||
char **result;
|
||||
|
Loading…
x
Reference in New Issue
Block a user