aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2005-09-20 18:59:02 +0000
committerBruce Momjian <bruce@momjian.us>2005-09-20 18:59:02 +0000
commitb7159824e610ad5ab71c2e8fb1cbad3946e2d2b2 (patch)
treedeae6d80cd29692c6ba3eb194124c23a3f5e717c /src
parent408c14026657c5cb5613cb557f5a9273e44454da (diff)
downloadpostgresql-b7159824e610ad5ab71c2e8fb1cbad3946e2d2b2.tar.gz
postgresql-b7159824e610ad5ab71c2e8fb1cbad3946e2d2b2.zip
Return proper value for psql -f filename failure if filename open fails.
Backpatch to 8.0.X.
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/command.c9
-rw-r--r--src/bin/psql/startup.c6
2 files changed, 8 insertions, 7 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index b46c0f9574a..c9a9e966d26 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.152 2005/08/14 18:49:30 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.153 2005/09/20 18:59:01 momjian Exp $
*/
#include "postgres_fe.h"
#include "command.h"
@@ -1314,7 +1314,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)
@@ -1324,7 +1325,7 @@ process_file(char *filename)
char *oldfilename;
if (!filename)
- return false;
+ return EXIT_FAILURE;
canonicalize_path(filename);
fd = fopen(filename, PG_BINARY_R);
@@ -1332,7 +1333,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 673e988745c..d1c90d2b95b 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.122 2005/09/05 18:05:13 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.123 2005/09/20 18:59:02 momjian Exp $
*/
#include "postgres_fe.h"
@@ -690,9 +690,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);
}