summaryrefslogtreecommitdiff
path: root/src/backend/libpq/hba.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-03-03 20:31:16 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-03-03 20:31:16 +0000
commitfe9a5f2f661370bf15a9dc059571c8ca9037aedc (patch)
tree53ee4bf7b46d02f946f5a7cbc66fe096b23f56ba /src/backend/libpq/hba.c
parentcad1ddf17c105964a15db2ce78747168d354ee62 (diff)
Fix a couple of places that would loop forever if attempts to read a stdio file
set ferror() but never set feof(). This is known to be the case for recent glibc when trying to read a directory as a file, and might be true for other platforms/cases too. Per report from Ed L. (There is more that we ought to do about his report, but this is one easily identifiable issue.)
Diffstat (limited to 'src/backend/libpq/hba.c')
-rw-r--r--src/backend/libpq/hba.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/libpq/hba.c b/src/backend/libpq/hba.c
index d5f44bb49f6..847687a05a6 100644
--- a/src/backend/libpq/hba.c
+++ b/src/backend/libpq/hba.c
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.188.2.1 2009/10/03 20:04:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/libpq/hba.c,v 1.188.2.2 2010/03/03 20:31:16 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -404,7 +404,7 @@ tokenize_file(const char *filename, FILE *file,
*lines = *line_nums = NIL;
- while (!feof(file))
+ while (!feof(file) && !ferror(file))
{
buf = next_token_expand(filename, file);