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

Lines changed: 6 additions & 2 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy