diff options
author | Jim Meyering <jim@meyering.net> | 2000-01-18 07:37:57 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2000-01-18 07:37:57 +0000 |
commit | 870858ccad8e42dfded42ce7eddfa0c53797dc6e (patch) | |
tree | c49cd4e4de838118bff6f661f12e8890acdc749c | |
parent | fa25e451f92c6e0d9166d04704b96e3118b8ca3b (diff) | |
download | coreutils-870858ccad8e42dfded42ce7eddfa0c53797dc6e.tar.xz |
(interrupt_handler, main):
Don't use SA_INTERRUPT to decide whether to call sigaction, as
POSIX.1 doesn't require SA_INTERRUPT and some systems
(e.g. Solaris 7) don't define it. Use SA_NOCLDSTOP instead;
it's been part of POSIX.1 since day 1 (in 1988).
-rw-r--r-- | src/csplit.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/csplit.c b/src/csplit.c index 855253f37..3be33fa92 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -1,5 +1,5 @@ /* csplit - split a file into sections determined by context lines - Copyright (C) 91, 1995-1999 Free Software Foundation, Inc. + Copyright (C) 91, 1995-2000 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -245,16 +245,16 @@ cleanup_fatal (void) static RETSIGTYPE interrupt_handler (int sig) { -#ifdef SA_INTERRUPT +#ifdef SA_NOCLDSTOP struct sigaction sigact; sigact.sa_handler = SIG_DFL; sigemptyset (&sigact.sa_mask); sigact.sa_flags = 0; sigaction (sig, &sigact, NULL); -#else /* !SA_INTERRUPT */ +#else signal (sig, SIG_DFL); -#endif /* SA_INTERRUPT */ +#endif cleanup (); kill (getpid (), sig); } @@ -1374,7 +1374,7 @@ main (int argc, char **argv) { int optc; unsigned long val; -#ifdef SA_INTERRUPT +#ifdef SA_NOCLDSTOP struct sigaction oldact, newact; #endif @@ -1393,7 +1393,7 @@ main (int argc, char **argv) /* Change the way xmalloc and xrealloc fail. */ xalloc_fail_func = cleanup; -#ifdef SA_INTERRUPT +#ifdef SA_NOCLDSTOP newact.sa_handler = interrupt_handler; sigemptyset (&newact.sa_mask); newact.sa_flags = 0; @@ -1413,7 +1413,7 @@ main (int argc, char **argv) sigaction (SIGTERM, NULL, &oldact); if (oldact.sa_handler != SIG_IGN) sigaction (SIGTERM, &newact, NULL); -#else /* not SA_INTERRUPT */ +#else if (signal (SIGHUP, SIG_IGN) != SIG_IGN) signal (SIGHUP, interrupt_handler); if (signal (SIGINT, SIG_IGN) != SIG_IGN) @@ -1422,7 +1422,7 @@ main (int argc, char **argv) signal (SIGQUIT, interrupt_handler); if (signal (SIGTERM, SIG_IGN) != SIG_IGN) signal (SIGTERM, interrupt_handler); -#endif /* not SA_INTERRUPT */ +#endif while ((optc = getopt_long (argc, argv, "f:b:kn:sqz", longopts, NULL)) != -1) switch (optc) |