diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-12-07 12:39:24 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-12-07 12:39:24 -0500 |
commit | cf59a8a4fe8dd83a069737ff32f1f211f352036c (patch) | |
tree | fc5b022d5d9feb765bdd14f48b74739d468bf18c /src/bin/psql/print.c | |
parent | ccb84dae13c9fcb0dec00ee337179e9f36700ba3 (diff) | |
download | postgresql-cf59a8a4fe8dd83a069737ff32f1f211f352036c.tar.gz postgresql-cf59a8a4fe8dd83a069737ff32f1f211f352036c.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/bin/psql/print.c')
-rw-r--r-- | src/bin/psql/print.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bin/psql/print.c b/src/bin/psql/print.c index 63514e342eb..cc8cd1140c7 100644 --- a/src/bin/psql/print.c +++ b/src/bin/psql/print.c @@ -2220,6 +2220,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 |