diff options
author | Bruce Momjian <bruce@momjian.us> | 2005-09-20 18:59:15 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2005-09-20 18:59:15 +0000 |
commit | b3af584d7d189cbde54bd0b4e8b6eb1e44321c40 (patch) | |
tree | f3c957608b64b3a5039fd6149827249ebb7f1596 | |
parent | b4d107a777db5c55ebae6e7f4463f4ff42bf91f2 (diff) | |
download | postgresql-b3af584d7d189cbde54bd0b4e8b6eb1e44321c40.tar.gz postgresql-b3af584d7d189cbde54bd0b4e8b6eb1e44321c40.zip |
Return proper value for psql -f filename failure if filename open fails.
Backpatch to 8.0.X.
-rw-r--r-- | src/bin/psql/command.c | 9 | ||||
-rw-r--r-- | src/bin/psql/startup.c | 6 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 4edacb28852..891421dfddf 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2005, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.139 2005/01/01 05:43:08 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.139.4.1 2005/09/20 18:59:15 momjian Exp $ */ #include "postgres_fe.h" #include "command.h" @@ -1298,7 +1298,8 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf) * process_file * * Read commands from filename and then them to the main processing loop - * Handler for \i, but can be used for other things as well. + * Handler for \i, but can be used for other things as well. Returns + * MainLoop() error code. */ int process_file(char *filename) @@ -1308,7 +1309,7 @@ process_file(char *filename) char *oldfilename; if (!filename) - return false; + return EXIT_FAILURE; canonicalize_path(filename); fd = fopen(filename, PG_BINARY_R); @@ -1316,7 +1317,7 @@ process_file(char *filename) if (!fd) { psql_error("%s: %s\n", filename, strerror(errno)); - return false; + return EXIT_FAILURE; } oldfilename = pset.inputfile; diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index 9aa51150c3e..3f04bc7ffe0 100644 --- a/src/bin/psql/startup.c +++ b/src/bin/psql/startup.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2005, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.112 2005/01/17 10:00:05 petere Exp $ + * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.112.4.1 2005/09/20 18:59:15 momjian Exp $ */ #include "postgres_fe.h" @@ -606,9 +606,9 @@ process_psqlrc_file(char *filename) sprintf(psqlrc, "%s-%s", filename, PG_VERSION); if (access(psqlrc, R_OK) == 0) - process_file(psqlrc); + (void)process_file(psqlrc); else if (access(filename, R_OK) == 0) - process_file(filename); + (void)process_file(filename); free(psqlrc); } |