diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-03-03 20:31:22 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-03-03 20:31:22 +0000 |
commit | 6fe45c96653632c7c77816b67680c8a6d2fcf789 (patch) | |
tree | 7fe6163d754831204f36dcc19763e27398ee6893 /src/interfaces/libpq/fe-connect.c | |
parent | e2524c518063428ed6a79c1b6d78f06a0eb251f7 (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 33cd597eaa0..627b091753a 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.356.2.1 2008/10/23 16:17:22 mha Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.356.2.2 2010/03/03 20:31:22 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -3755,7 +3755,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; |