diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2005-04-09 04:57:37 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2005-04-09 04:57:37 +0000 |
commit | ed74cc7c26cb3350671ffdd6fc44da5d04685122 (patch) | |
tree | 6fe31b054dadfbbb44b3fe00f8ce9202ba9a8780 | |
parent | 9fd2c631bf75c1f0139fe57d24a01f2766f3efe9 (diff) | |
download | coreutils-ed74cc7c26cb3350671ffdd6fc44da5d04685122.tar.xz |
(SA_NOCLDSTOP): Define to 0 if not defined.
All uses changed.
(siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
(main) [! SA_NOCLDSTOP]: Use it.
-rw-r--r-- | src/sort.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/sort.c b/src/sort.c index 3ecd904b7..2531b004c 100644 --- a/src/sort.c +++ b/src/sort.c @@ -55,9 +55,15 @@ struct rlimit { size_t rlim_cur; }; # include <langinfo.h> #endif +/* Use SA_NOCLDSTOP as a proxy for whether the sigaction machinery is + present. */ #ifndef SA_NOCLDSTOP +# define SA_NOCLDSTOP 0 # define sigprocmask(How, Set, Oset) /* empty */ # define sigset_t int +# if ! HAVE_SIGINTERRUPT +# define siginterrupt(sig, flag) /* empty */ +# endif #endif #ifndef STDC_HEADERS @@ -2210,9 +2216,8 @@ parse_field_count (char const *string, size_t *val, char const *msgid) static void sighandler (int sig) { -#ifndef SA_NOCLDSTOP - signal (sig, SIG_IGN); -#endif + if (! SA_NOCLDSTOP) + signal (sig, SIG_IGN); cleanup (); @@ -2337,7 +2342,7 @@ main (int argc, char **argv) static int const sig[] = { SIGHUP, SIGINT, SIGPIPE, SIGTERM }; enum { nsigs = sizeof sig / sizeof sig[0] }; -#ifdef SA_NOCLDSTOP +#if SA_NOCLDSTOP struct sigaction act; sigemptyset (&caught_signals); @@ -2358,7 +2363,10 @@ main (int argc, char **argv) #else for (i = 0; i < nsigs; i++) if (signal (sig[i], SIG_IGN) != SIG_IGN) - signal (sig[i], sighandler); + { + signal (sig[i], sighandler); + siginterrupt (sig[i], 1); + } #endif } |