Restore psql's SIGPIPE setting if popen() fails.

Ancient oversight in PageOutput(): if popen() fails, we'd better reset
the SIGPIPE handler before returning stdout, because ClosePager() won't.
Noticed while fixing the empty-PAGER issue.
This commit is contained in:
Tom Lane 2016-12-07 12:39:24 -05:00
parent 18f8f784cb
commit b7e1ae2328
1 changed files with 2 additions and 0 deletions

View File

@ -2884,6 +2884,8 @@ PageOutput(int lines, const printTableOpt *topt)
pagerpipe = popen(pagerprog, "w");
if (pagerpipe)
return pagerpipe;
/* if popen fails, silently proceed without pager */
restore_sigpipe_trap();
}
}