diff options
author | Pádraig Brady <P@draigBrady.com> | 2011-05-19 23:23:23 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2011-05-26 00:10:32 +0100 |
commit | 5908e29e825286121c69f5c10c313ccae6860fa7 (patch) | |
tree | 27612890659fa217afe24a0ffd314d93308852ef /src | |
parent | d92849fe5a9c8a24203f70b02806737666cb980b (diff) | |
download | coreutils-5908e29e825286121c69f5c10c313ccae6860fa7.tar.xz |
split: return success even if a --filter exits
src/split.c (main): Don't unblock SIGPIPE before cleanup,
as then any pending signals will be sent and cause
the main split process to exit with a non zero status (141).
* test/split/filter: Add a test for this case.
Diffstat (limited to 'src')
-rw-r--r-- | src/split.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/split.c b/src/split.c index 6c75080a7..3f925380e 100644 --- a/src/split.c +++ b/src/split.c @@ -1230,15 +1230,15 @@ main (int argc, char **argv) /* When filtering, closure of one pipe must not terminate the process, as there may still be other streams expecting input from us. */ - sigemptyset (&newblocked); if (filter_command) { struct sigaction act; + sigemptyset (&newblocked); sigaction (SIGPIPE, NULL, &act); if (act.sa_handler != SIG_IGN) sigaddset (&newblocked, SIGPIPE); + sigprocmask (SIG_BLOCK, &newblocked, &oldblocked); } - sigprocmask (SIG_BLOCK, &newblocked, &oldblocked); switch (split_type) { @@ -1276,8 +1276,6 @@ main (int argc, char **argv) abort (); } - sigprocmask (SIG_SETMASK, &oldblocked, NULL); - if (close (STDIN_FILENO) != 0) error (EXIT_FAILURE, errno, "%s", infile); closeout (NULL, output_desc, filter_pid, outfile); |