diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-03-03 20:31:16 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-03-03 20:31:16 +0000 |
commit | fe9a5f2f661370bf15a9dc059571c8ca9037aedc (patch) | |
tree | 53ee4bf7b46d02f946f5a7cbc66fe096b23f56ba /src/interfaces/libpq/fe-connect.c | |
parent | cad1ddf17c105964a15db2ce78747168d354ee62 (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/interfaces/libpq/fe-connect.c')
-rw-r--r-- | src/interfaces/libpq/fe-connect.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index d20d0b60106..4a07bafe6d8 100644 --- a/src/interfaces/libpq/fe-connect.c +++ b/src/interfaces/libpq/fe-connect.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.375 2009/06/11 14:49:13 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.375.2.1 2010/03/03 20:31:16 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -3891,7 +3891,7 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username) if (fp == NULL) return NULL; - while (!feof(fp)) + while (!feof(fp) && !ferror(fp)) { char *t = buf, *ret; |