summaryrefslogtreecommitdiff
path: root/src/interfaces/libpq/fe-connect.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2010-03-03 20:31:50 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2010-03-03 20:31:50 +0000
commitf82e8e7f6ff066ca019ed9a2cab1d78bd43738c6 (patch)
treeedaae7151ea028dcac4c99d9e8287bb1ea06007f /src/interfaces/libpq/fe-connect.c
parent8b33d83cc59d38a83f7cd4abe7738835e24f8624 (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.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c
index 0ff901639ac..5ff0fc68c24 100644
--- a/src/interfaces/libpq/fe-connect.c
+++ b/src/interfaces/libpq/fe-connect.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.263.2.6 2007/07/23 18:10:13 mha Exp $
+ * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v 1.263.2.7 2010/03/03 20:31:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -3159,7 +3159,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;