summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2010-02-08 04:57:30 +0000
committerColin Watson <cjwatson@debian.org>2010-02-08 04:57:30 +0000
commitd175433b8aae33c57ba8756b31e6abff2a899f29 (patch)
treee539fd3deccca29e89a8f6b2900051399b41d1ab /src
parente06b0ffa961509080474669ace5f589131b82ea6 (diff)
* src/man.c (format_display_and_save): Use sigaction, not signal.
Diffstat (limited to 'src')
-rw-r--r--src/man.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/man.c b/src/man.c
index 41a09951..ea2ed2fa 100644
--- a/src/man.c
+++ b/src/man.c
@@ -2108,7 +2108,13 @@ static int format_display_and_save (pipeline *decomp,
{
pipeline *sav_p = open_cat_stream (cat_file);
int instat;
- RETSIGTYPE (*old_handler)(int) = signal (SIGPIPE, SIG_IGN);
+ struct sigaction sa, osa_sigpipe;
+
+ memset (&sa, 0, sizeof sa);
+ sa.sa_handler = SIG_IGN;
+ sigemptyset (&sa.sa_mask);
+ sa.sa_flags = 0;
+ sigaction (SIGPIPE, &sa, &osa_sigpipe);
if (global_manpath)
drop_effective_privs ();
@@ -2132,7 +2138,7 @@ static int format_display_and_save (pipeline *decomp,
if (sav_p)
close_cat_stream (sav_p, cat_file, instat);
pipeline_wait (disp_cmd);
- signal (SIGPIPE, old_handler);
+ sigaction (SIGPIPE, &osa_sigpipe, NULL);
return instat;
}
#endif /* MAN_CATS */