mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-07-28 03:19:55 +02:00
(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).
This commit is contained in:
+8
-8
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user