postgres.git / summary / log / commit / refs

commit    b7e1ae2328f7d5a88d8916d78b4561d8ef16f99b
Author:   Tom Lane <tgl@sss.pgh.pa.us>
Date:     Wed Dec 07 17:39:24 2016 +0000
First released in: 10.0, 9.2.20, 9.3.16, 9.4.11, 9.5.6, 9.6.2

    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.


src/fe_utils/print.c | 2 ++ 1 file changed, 2 insertions(+) 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(); } } [parent: 18f8f784cbbf]