diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-03-03 20:31:29 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-03-03 20:31:29 +0000 |
commit | 48fcbb803bb7fefd04a750130adf4dabf1a274e0 (patch) | |
tree | 137ada88c23751187ba9a9c17990c44d27169884 /src/interfaces/libpq/fe-connect.c | |
parent | c4810d9ae05a4c6b93cfbe5e58ae55cd1a0d3808 (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 4a0f86cbf0f..5412ee606ff 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.339.2.3 2007/10/09 15:03:31 mha Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.339.2.4 2010/03/03 20:31:29 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -3637,7 +3637,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; |