From 1b8fe53c79f9b9b411733047de2a7a809b506591 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 3 Mar 2010 20:31:41 +0000 Subject: 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.) --- src/backend/commands/copy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/backend/commands/copy.c') diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 44077a3fb29..b48e5b93f5a 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.236.4.3 2006/05/21 20:06:16 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.236.4.4 2010/03/03 20:31:41 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -393,7 +393,7 @@ CopyGetData(void *databuf, int datasize) { case COPY_FILE: fread(databuf, datasize, 1, copy_file); - if (feof(copy_file)) + if (feof(copy_file) || ferror(copy_file)) fe_eof = true; break; case COPY_OLD_FE: -- cgit v1.2.3