aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-09-02 02:40:59 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-09-02 02:40:59 +0000
commit9a6313f469594feb01fa2e213d3a2d2daf0029cd (patch)
tree634065b8d24606240f1baa3617251a2769fd37a1 /src
parentba5317237fe57acda122d793e8c95f960bbb31ed (diff)
downloadpostgresql-9a6313f469594feb01fa2e213d3a2d2daf0029cd.tar.gz
postgresql-9a6313f469594feb01fa2e213d3a2d2daf0029cd.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_ctl/pg_ctl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bin/pg_ctl/pg_ctl.c b/src/bin/pg_ctl/pg_ctl.c
index 40ede2c1a83..7a7d03e8f69 100644
--- a/src/bin/pg_ctl/pg_ctl.c
+++ b/src/bin/pg_ctl/pg_ctl.c
@@ -4,7 +4,7 @@
*
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.111 2009/06/11 14:49:07 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.111.2.1 2009/09/02 02:40:59 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -292,7 +292,7 @@ static char **
readfile(const char *path)
{
FILE *infile;
- int maxlength = 0,
+ int maxlength = 1,
linelen = 0;
int nlines = 0;
char **result;