]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(sighandler, main):
authorJim Meyering <jim@meyering.net>
Tue, 18 Jan 2000 07:36:53 +0000 (07:36 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 18 Jan 2000 07:36:53 +0000 (07:36 +0000)
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).

src/sort.c

index f6e76bcec836ed2134a7f979bbbc466bc72756a4..c0e1a0cfd2dec9b16a52668c5eaf68cc8a26189a 100644 (file)
@@ -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;