summaryrefslogtreecommitdiff
path: root/lib/pipeline.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2007-02-28 22:01:33 +0000
committerColin Watson <cjwatson@debian.org>2007-02-28 22:01:33 +0000
commita7b20c8875d8e43292fed6af1dee2aae4ab6e752 (patch)
treec040a3fe4f8ea41b1c491ccecf3cb7f262ca24c8 /lib/pipeline.c
parentd6c8ad95d0aa8c7444aea1f56dbb66434d9fa96e (diff)
* lib/pipeline.c (pipeline_start): Don't ignore SIGPIPE in
subprocesses; this has undesirable consequences in some situations. (pipeline_wait): Flatten SIGPIPE exit statuses to zero instead.
Diffstat (limited to 'lib/pipeline.c')
-rw-r--r--lib/pipeline.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/lib/pipeline.c b/lib/pipeline.c
index 72ca5103..c5d70c7e 100644
--- a/lib/pipeline.c
+++ b/lib/pipeline.c
@@ -631,8 +631,6 @@ void pipeline_start (pipeline *p)
if (pid < 0)
error (FATAL, errno, _("fork failed"));
if (pid == 0) {
- struct sigaction sa;
-
/* child */
pop_all_cleanups ();
@@ -675,11 +673,6 @@ void pipeline_start (pipeline *p)
/* Restore signals. */
xsigaction (SIGINT, &osa_sigint, NULL);
xsigaction (SIGQUIT, &osa_sigquit, NULL);
- /* ... but we don't want to know about SIGPIPE. */
- sa.sa_handler = SIG_IGN;
- sigemptyset(&sa.sa_mask);
- sa.sa_flags = 0;
- xsigaction (SIGPIPE, &sa, NULL);
execvp (p->commands[i]->name, p->commands[i]->argv);
error (EXEC_FAILED_EXIT_STATUS, errno,
@@ -833,7 +826,9 @@ int pipeline_wait (pipeline *p)
if (WIFSIGNALED (status)) {
int sig = WTERMSIG (status);
#ifdef SIGPIPE
- if (sig != SIGPIPE) {
+ if (sig == SIGPIPE)
+ status = 0;
+ else {
#endif /* SIGPIPE */
if (WCOREDUMP (status))
error (0, 0,