summaryrefslogtreecommitdiff
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
commit433e65c2bd907723a5d93b3f2ff0bdbc77a0b625 (patch)
treed01146e0a1b0019d262fed14f4b13c227af61223 /src
parent82eb5c5144732df7774fe1f83c0b079e068c5be9 (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.
Diffstat (limited to 'src')
-rw-r--r--src/bin/psql/print.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c
index 85ac76b8fe3..b48fb8dd7ff 100644
--- a/src/bin/psql/print.c
+++ b/src/bin/psql/print.c
@@ -2217,6 +2217,10 @@ PageOutput(int lines, unsigned short int pager)
pagerpipe = popen(pagerprog, "w");
if (pagerpipe)
return pagerpipe;
+ /* if popen fails, silently proceed without pager */
+#ifndef WIN32
+ pqsignal(SIGPIPE, SIG_DFL);
+#endif
#ifdef TIOCGWINSZ
}
#endif