Skip to content

Commit 521f045

Browse files
committed
Make failure to open psql's --log-file fatal.
Commit 344cdff 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
1 parent 938d797 commit 521f045

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/bin/psql/startup.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,11 @@ main(int argc, char *argv[])
287287
{
288288
pset.logfile = fopen(options.logfilename, "a");
289289
if (!pset.logfile)
290+
{
290291
fprintf(stderr, _("%s: could not open log file \"%s\": %s\n"),
291292
pset.progname, options.logfilename, strerror(errno));
293+
exit(EXIT_FAILURE);
294+
}
292295
}
293296

294297
if (!options.no_psqlrc)

0 commit comments

Comments
 (0)