diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-07-31 10:31:17 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-07-31 10:31:17 +0200 |
commit | 50dc1f5b71f7e0e4ba628904b9a47d9f9d875b3e (patch) | |
tree | 770054765d335695236e3c1c26f952a9aa76ff29 /src/libutil/util.cc | |
parent | 45f9a91e186d91edbf2bed7d27b7fa7227730596 (diff) |
Restore default SIGPIPE handler before invoking ‘man’
Fixes NixOS/nixpkgs#3410.
Diffstat (limited to 'src/libutil/util.cc')
-rw-r--r-- | src/libutil/util.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index aa9d99ec3..f762b79c2 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -927,6 +927,16 @@ void closeOnExec(int fd) } +void restoreSIGPIPE() +{ + struct sigaction act, oact; + act.sa_handler = SIG_DFL; + act.sa_flags = 0; + sigemptyset(&act.sa_mask); + if (sigaction(SIGPIPE, &act, &oact)) throw SysError("resetting SIGPIPE"); +} + + ////////////////////////////////////////////////////////////////////// |