From 09543580471182ecab3b73c982485397edabbce2 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 30 Apr 2010 17:09:13 +0000 Subject: Fix a couple of places where the result of fgets() wasn't checked. This is mostly to suppress compiler warnings, although in principle the cases could result in undesirable behavior. Martin Pitt --- src/interfaces/libpq/fe-connect.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/interfaces/libpq/fe-connect.c') diff --git a/src/interfaces/libpq/fe-connect.c b/src/interfaces/libpq/fe-connect.c index e2d1355a3db..54db2b7b896 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.391 2010/03/17 20:58:38 petere Exp $ + * $PostgreSQL: pgsql/src/interfaces/libpq/fe-connect.c,v 1.392 2010/04/30 17:09:13 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -4400,7 +4400,8 @@ PasswordFromFile(char *hostname, char *port, char *dbname, char *username) *ret; int len; - fgets(buf, sizeof(buf), fp); + if (fgets(buf, sizeof(buf), fp) == NULL) + break; len = strlen(buf); if (len == 0) -- cgit v1.2.3