Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 92d77c6

Browse files
committed
Fix line count error reporting in config files, like pg_hba.conf, per
report from Oliver Elphick. Backpatch to 7.3.
1 parent d9d59ca commit 92d77c6

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/backend/libpq/hba.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.90 2002/12/06 04:37:02 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.91 2002/12/11 22:17:11 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -93,6 +93,7 @@ void
9393
next_token(FILE *fp, char *buf, const int bufsz)
9494
{
9595
int c;
96+
char *start_buf = buf;
9697
char *end_buf = buf + (bufsz - 1);
9798
bool in_quote = false;
9899
bool was_quote = false;
@@ -115,7 +116,10 @@ next_token(FILE *fp, char *buf, const int bufsz)
115116
{
116117
while ((c = getc(fp)) != EOF && c != '\n')
117118
;
118-
continue;
119+
/* If only comment, consume EOL too; return EOL */
120+
if (c != EOF && buf == start_buf)
121+
c = getc(fp);
122+
break;
119123
}
120124

121125
if (buf >= end_buf)

0 commit comments

Comments
 (0)