summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-12-07 12:39:24 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2016-12-07 12:39:24 -0500
commit29babe981cba76d934aa4936ca393ddd2894c4e7 (patch)
tree64d95254cf770ab04896eba5f4033c045eb09bcb
parentbb39f58f76b43bf0ef234e1baaf824e2cb9c9210 (diff)
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.
-rw-r--r--src/fe_utils/print.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/fe_utils/print.c b/src/fe_utils/print.c
index 5c5d285be5f..daa23d1955a 100644
--- a/src/fe_utils/print.c
+++ b/src/fe_utils/print.c
@@ -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();
}
}