From: Tom Lane Date: Tue, 8 Dec 2015 22:14:46 +0000 (-0500) Subject: Make failure to open psql's --log-file fatal. X-Git-Tag: REL9_6_BETA1~1026 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=521f0458dcd7bb28636250cdfce9b1a3020cff4c;p=postgresql 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 --- diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index 7af38fbab0..17fb943dfa 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)