aboutsummaryrefslogtreecommitdiff
path: root/src
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
commit93c78ba19b378b4b54dad5ceb4fdf063bb0998e1 (patch)
treeb2c08e1379712cda21f351ec54ffcb7ecd9b5f72 /src
parent370c7a863aa7410029d1406a43871722b1f9a8af (diff)
downloadpostgresql-93c78ba19b378b4b54dad5ceb4fdf063bb0998e1.tar.gz
postgresql-93c78ba19b378b4b54dad5ceb4fdf063bb0998e1.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/print.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c
index f45ce677d08..a1d2e9709d1 100644
--- a/src/bin/psql/print.c
+++ b/src/bin/psql/print.c
@@ -2880,6 +2880,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();
}
}