Attempt to raise the default signal handler (SIG_DFL) when exiting because
of a signal, rather than just relying upon exit(3).
This commit is contained in:
parent
a93b9bed51
commit
2c1030d08e
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: at.c,v 1.23 2007/07/18 01:06:08 lukem Exp $ */
|
||||
/* $NetBSD: at.c,v 1.24 2007/07/18 01:13:42 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* at.c : Put file into atrun queue
|
||||
@ -70,7 +70,7 @@ enum { ATQ, ATRM, AT, BATCH, CAT }; /* what program we want to run */
|
||||
#if 0
|
||||
static char rcsid[] = "$OpenBSD: at.c,v 1.15 1998/06/03 16:20:26 deraadt Exp $";
|
||||
#else
|
||||
__RCSID("$NetBSD: at.c,v 1.23 2007/07/18 01:06:08 lukem Exp $");
|
||||
__RCSID("$NetBSD: at.c,v 1.24 2007/07/18 01:13:42 lukem Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -106,13 +106,22 @@ static void process_jobs (int, char **, int);
|
||||
static void
|
||||
sigc(int signo)
|
||||
{
|
||||
/* If the user presses ^C, remove the spool file and exit. */
|
||||
struct sigaction act;
|
||||
|
||||
/* If a signal interrupts us, remove the spool file and exit. */
|
||||
if (fcreated) {
|
||||
PRIV_START
|
||||
(void)unlink(atfile);
|
||||
PRIV_END
|
||||
}
|
||||
|
||||
/* Raise the default signal handler for the signal that was invoked. */
|
||||
memset(&act, 0, sizeof act);
|
||||
act.sa_handler = SIG_DFL;
|
||||
sigemptyset(&(act.sa_mask));
|
||||
act.sa_flags = 0;
|
||||
sigaction(signo, &act, NULL);
|
||||
raise(signo);
|
||||
/* Fall-back to exit */
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
@ -121,7 +130,8 @@ static void
|
||||
alarmc(int signo)
|
||||
{
|
||||
/* Time out after some seconds. */
|
||||
panic("File locking timed out");
|
||||
warnx("File locking timed out");
|
||||
sigc(signo);
|
||||
}
|
||||
|
||||
/* Local functions */
|
||||
|
Loading…
Reference in New Issue
Block a user