- csplit sometimes failed to remove files when interrupted.
authorJim Meyering <jim@meyering.net>
Wed, 21 Apr 2004 12:57:33 +0000 (12:57 +0000)
committerJim Meyering <jim@meyering.net>
Wed, 21 Apr 2004 12:57:33 +0000 (12:57 +0000)
commit8ab60c41be82dceeac0a0d8fec2842c3773ef7a5
treebfa50b5abdb99033e2dde9302a204d5be59e12e1
parenteae1b7f862ae45e7898304cd81332f12bd8fbdf7
 - csplit sometimes failed to remove files when interrupted.
 - csplit didn't clean up if two signals arrived nearly simultaneously.

(sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: Define.
(filename_space, prefix, suffix, digits, files_created, remove_files): Now volatile.
(caught_signals): New var.
(cleanup): Block signals while deleting all files.
(cleanup_fatal, handle_line_error, regexp_error):
Mark with ATTRIBUTE_NORETURN.
(create_output_file, close_output_file, interrupt_handler):
Block signals while changing the number of output files,
to fix some race conditions.
(delete_all_files): Do nothing if remove_files is zero.
Clear files_created.
(main): Don't mess with signals until after argument processing is done.

(main): Rewrite signal-catching code to make it
similar to other coreutils programs.  When processing signals,
block all signals that we catch, but do not block signals that we
don't catch.  Avoid problems with unsigned int warnings.

(interrupt_handler): Use void, not (obsolete) RETSIGTYPE.

(interrupt_handler) [defined SA_NOCLDSTOP]:
Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
src/csplit.c