Commit 521f0458 authored by Tom Lane's avatar Tom Lane

Make failure to open psql's --log-file fatal.

Commit 344cdff2 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
parent 938d797b
...@@ -287,8 +287,11 @@ main(int argc, char *argv[]) ...@@ -287,8 +287,11 @@ main(int argc, char *argv[])
{ {
pset.logfile = fopen(options.logfilename, "a"); pset.logfile = fopen(options.logfilename, "a");
if (!pset.logfile) if (!pset.logfile)
{
fprintf(stderr, _("%s: could not open log file \"%s\": %s\n"), fprintf(stderr, _("%s: could not open log file \"%s\": %s\n"),
pset.progname, options.logfilename, strerror(errno)); pset.progname, options.logfilename, strerror(errno));
exit(EXIT_FAILURE);
}
} }
if (!options.no_psqlrc) if (!options.no_psqlrc)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment