summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-07-15 16:03:41 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-07-15 16:03:57 -0700
commit837e1f55196f826b92d660808f594fde36651655 (patch)
tree8981920bd1d1067e7e3a4f24516644241a52961b /src
parent750fadd5d3a7b053e5a78c9b5144fd36fa64f198 (diff)
downloadcoreutils-837e1f55196f826b92d660808f594fde36651655.tar.xz
csplit: don't prematurely terminate cleanup (Bug#9076)
* src/csplit.c (interrupt_handler): Reset signal to SIG_DFL after deleting the files, so that a second interrupt won't prematurely terminate cleanup. (main): Don't use SA_NODEFER | SA_RESETHAND, as that might allow premature termination of cleanup. Also, this ports better to platforms like NonStop, which don't ahve SA_RESETHAND.
Diffstat (limited to 'src')
-rw-r--r--src/csplit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/csplit.c b/src/csplit.c
index 438d888a5..5d84c4580 100644
--- a/src/csplit.c
+++ b/src/csplit.c
@@ -225,6 +225,7 @@ static void
interrupt_handler (int sig)
{
delete_all_files (true);
+ signal (sig, SIG_DFL);
/* The signal has been reset to SIG_DFL, but blocked during this
handler. Force the default action of this signal once the
handler returns and the block is removed. */
@@ -1421,7 +1422,7 @@ main (int argc, char **argv)
act.sa_handler = interrupt_handler;
act.sa_mask = caught_signals;
- act.sa_flags = SA_NODEFER | SA_RESETHAND;
+ act.sa_flags = 0;
for (i = 0; i < nsigs; i++)
if (sigismember (&caught_signals, sig[i]))