diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-12-08 17:14:46 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-12-08 17:14:46 -0500 |
commit | 521f0458dcd7bb28636250cdfce9b1a3020cff4c (patch) | |
tree | 89a65e4310e02678eb1fb6692b572557d2c213f7 /src | |
parent | 938d797b84467ebbaed432da72d1d7f7bb266110 (diff) | |
download | postgresql-521f0458dcd7bb28636250cdfce9b1a3020cff4c.tar.gz postgresql-521f0458dcd7bb28636250cdfce9b1a3020cff4c.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.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index 7af38fbab0a..17fb943dfab 100644 --- a/src/bin/psql/startup.c +++ b/src/bin/psql/startup.c @@ -287,8 +287,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); + } } if (!options.no_psqlrc) |