Skip to content

Commit 433e65c

Browse files
committed
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.
1 parent 82eb5c5 commit 433e65c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/bin/psql/print.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2217,6 +2217,10 @@ PageOutput(int lines, unsigned short int pager)
22172217
pagerpipe = popen(pagerprog, "w");
22182218
if (pagerpipe)
22192219
return pagerpipe;
2220+
/* if popen fails, silently proceed without pager */
2221+
#ifndef WIN32
2222+
pqsignal(SIGPIPE, SIG_DFL);
2223+
#endif
22202224
#ifdef TIOCGWINSZ
22212225
}
22222226
#endif

0 commit comments

Comments
 (0)