From: Jim Meyering Date: Tue, 29 Oct 1996 04:16:59 +0000 (+0000) Subject: (main): Ignore SIGPIPE. X-Git-Tag: TEXTUTILS-1_19q~210 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84b8cf9fcf25a4e288841f690879a898417b7d99;p=thirdparty%2Fcoreutils.git (main): Ignore SIGPIPE. --- diff --git a/src/tee.c b/src/tee.c index 458c50ba48..fe104a8e94 100644 --- a/src/tee.c +++ b/src/tee.c @@ -135,6 +135,21 @@ main (int argc, char **argv) #endif /* _POSIX_SOURCE */ } + /* Don't let us be killed if one of the output files is a pipe that + doesn't consume all its input. */ +#ifdef _POSIX_SOURCE + { + struct sigaction sigact; + + sigact.sa_handler = SIG_IGN; + sigemptyset (&sigact.sa_mask); + sigact.sa_flags = 0; + sigaction (SIGPIPE, &sigact, NULL); + } +#else + signal (SIGPIPE, SIG_IGN); +#endif + errs = tee (argc - optind, (const char **) &argv[optind]); if (close (0) != 0) error (1, errno, _("standard input"));