diff options
Diffstat (limited to 'src/bin/psql/input.c')
-rw-r--r-- | src/bin/psql/input.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c index be30e9fcf78..47c3d55fa48 100644 --- a/src/bin/psql/input.c +++ b/src/bin/psql/input.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2007, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.62 2007/01/05 22:19:49 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/input.c,v 1.63 2007/11/28 09:17:46 petere Exp $ */ #include "postgres_fe.h" @@ -147,7 +147,7 @@ pg_send_history(PQExpBuffer history_buf) * gets_fromFile * * Gets a line of noninteractive input from a file (which could be stdin). - * The result is a malloc'd string. + * The result is a malloc'd string, or NULL on EOF or input error. * * Caller *must* have set up sigint_interrupt_jmp before calling. * @@ -179,9 +179,16 @@ gets_fromFile(FILE *source) /* Disable SIGINT again */ sigint_interrupt_enabled = false; - /* EOF? */ + /* EOF or error? */ if (result == NULL) + { + if (ferror(source)) + { + psql_error("could not read from input file: %s\n", strerror(errno)); + return NULL; + } break; + } appendPQExpBufferStr(buffer, line); |