diff -ru ../../../../cvs-pgsql/src/bin/psql/input.c ./input.c --- ../../../../cvs-pgsql/src/bin/psql/input.c 2007-01-05 23:19:49.000000000 +0100 +++ ./input.c 2007-11-15 13:59:22.000000000 +0100 @@ -179,7 +179,7 @@ /* Disable SIGINT again */ sigint_interrupt_enabled = false; - /* EOF? */ + /* EOF or error? */ if (result == NULL) break; diff -ru ../../../../cvs-pgsql/src/bin/psql/mainloop.c ./mainloop.c --- ../../../../cvs-pgsql/src/bin/psql/mainloop.c 2007-01-05 23:19:49.000000000 +0100 +++ ./mainloop.c 2007-11-15 13:57:36.000000000 +0100 @@ -129,7 +129,14 @@ line = gets_interactive(get_prompt(prompt_status)); } else + { line = gets_fromFile(source); + if (!line && ferror(source)) + { + psql_error("could not read from input file: %s\n", strerror(errno)); + successResult = EXIT_FAILURE; + } + } /* * query_buf holds query already accumulated. line is the malloc'd