summaryrefslogtreecommitdiff
path: root/src/backend/commands/copy.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/backend/commands/copy.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/backend/commands/copy.c')
-rw-r--r--src/backend/commands/copy.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index ba371f728d9..497a67ab815 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.213.2.3 2006/05/21 20:06:43 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.213.2.4 2010/03/03 20:31:50 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -381,7 +381,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: