From: Bruce Momjian Date: Wed, 11 Dec 2002 22:17:31 +0000 (+0000) Subject: Fix line count error reporting in config files, like pg_hba.conf, per X-Git-Tag: REL7_3_1~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bab9c3d5551db2e2c5620671f5679cfaec8584b9;p=thirdparty%2Fpostgresql.git Fix line count error reporting in config files, like pg_hba.conf, per report from Oliver Elphick. Backpatch to 7.3. --- diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c index cda4bc93aeb..67da2f78adf 100644 --- a/src/backend/libpq/hba.c +++ b/src/backend/libpq/hba.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.87 2002/09/04 20:31:19 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.87.2.1 2002/12/11 22:17:31 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -93,6 +93,7 @@ void next_token(FILE *fp, char *buf, const int bufsz) { int c; + char *start_buf = buf; char *end_buf = buf + (bufsz - 1); bool in_quote = false; bool was_quote = false; @@ -115,7 +116,10 @@ next_token(FILE *fp, char *buf, const int bufsz) { while ((c = getc(fp)) != EOF && c != '\n') ; - continue; + /* If only comment, consume EOL too; return EOL */ + if (c != EOF && buf == start_buf) + c = getc(fp); + break; } if (buf >= end_buf)