aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2015-12-08 17:14:46 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2015-12-08 17:14:46 -0500
commite90371d1a79f4398867f4f3bb8547e94259b07b5 (patch)
tree56242250dbcd316d285d476120ea2459bdd11212 /src
parent59f10ffa5bc1f39a5ce00806b394feb8f207bb33 (diff)
downloadpostgresql-e90371d1a79f4398867f4f3bb8547e94259b07b5.tar.gz
postgresql-e90371d1a79f4398867f4f3bb8547e94259b07b5.zip
Make failure to open psql's --log-file fatal.
Commit 344cdff2c made failure to open the target of --output fatal. For consistency, the --log-file switch should behave similarly. Like the previous commit, back-patch to 9.5 but no further. Daniel Verite
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/startup.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c
index a6e23c2f3e4..8b1777e2436 100644
--- a/src/bin/psql/startup.c
+++ b/src/bin/psql/startup.c
@@ -274,8 +274,11 @@ main(int argc, char *argv[])
{
pset.logfile = fopen(options.logfilename, "a");
if (!pset.logfile)
+ {
fprintf(stderr, _("%s: could not open log file \"%s\": %s\n"),
pset.progname, options.logfilename, strerror(errno));
+ exit(EXIT_FAILURE);
+ }
}
/*