summaryrefslogtreecommitdiff
path: root/src/sort.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2000-01-18 07:36:53 +0000
committerJim Meyering <jim@meyering.net>2000-01-18 07:36:53 +0000
commit3e115cf2b52e424b2dfd6ff40c2d335c4249928a (patch)
tree6570d94caf2f13e61cd2dd2f6504e9ea38d8a0d8 /src/sort.c
parent41a7e7c193ddc53414683bda043082fdb327f7fd (diff)
downloadcoreutils-3e115cf2b52e424b2dfd6ff40c2d335c4249928a.tar.xz
(sighandler, 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).
Diffstat (limited to 'src/sort.c')
-rw-r--r--src/sort.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/sort.c b/src/sort.c
index f6e76bcec..c0e1a0cfd 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -1796,16 +1796,16 @@ badfieldspec (const char *s)
static void
sighandler (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);
}
@@ -1874,9 +1874,9 @@ main (int argc, char **argv)
int checkonly = 0, mergeonly = 0, nfiles = 0;
char *minus = "-", *outfile = minus, **files, *tmp;
FILE *ofp;
-#ifdef SA_INTERRUPT
+#ifdef SA_NOCLDSTOP
struct sigaction oldact, newact;
-#endif /* SA_INTERRUPT */
+#endif
program_name = argv[0];
setlocale (LC_ALL, "");
@@ -1924,7 +1924,7 @@ main (int argc, char **argv)
xalloc_exit_failure = SORT_FAILURE;
xalloc_fail_func = cleanup;
-#ifdef SA_INTERRUPT
+#ifdef SA_NOCLDSTOP
newact.sa_handler = sighandler;
sigemptyset (&newact.sa_mask);
newact.sa_flags = 0;
@@ -1941,7 +1941,7 @@ main (int argc, char **argv)
sigaction (SIGTERM, NULL, &oldact);
if (oldact.sa_handler != SIG_IGN)
sigaction (SIGTERM, &newact, NULL);
-#else /* !SA_INTERRUPT */
+#else
if (signal (SIGINT, SIG_IGN) != SIG_IGN)
signal (SIGINT, sighandler);
if (signal (SIGHUP, SIG_IGN) != SIG_IGN)
@@ -1950,7 +1950,7 @@ main (int argc, char **argv)
signal (SIGPIPE, sighandler);
if (signal (SIGTERM, SIG_IGN) != SIG_IGN)
signal (SIGTERM, sighandler);
-#endif /* !SA_INTERRUPT */
+#endif
gkey.sword = gkey.eword = -1;
gkey.ignore = NULL;