Convert to using raise_default_signal(3).

This commit is contained in:
lukem 2007-10-05 07:22:23 +00:00
parent 32fddb3293
commit db822d2217
5 changed files with 21 additions and 34 deletions

View File

@ -1,9 +1,12 @@
# $NetBSD: Makefile,v 1.11 2005/06/26 19:10:49 christos Exp $
# $NetBSD: Makefile,v 1.12 2007/10/05 07:23:09 lukem Exp $
# @(#)Makefile 8.1 (Berkeley) 5/31/93
PROG= dd
SRCS= args.c conv.c dd.c misc.c position.c
DPADD+= ${LIBUTIL}
LDADD+= -lutil
.ifdef SMALLPROG
CPPFLAGS+= -DNO_CONV
.else

View File

@ -1,4 +1,4 @@
/* $NetBSD: misc.c,v 1.20 2007/07/03 05:25:25 lukem Exp $ */
/* $NetBSD: misc.c,v 1.21 2007/10/05 07:23:09 lukem Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: misc.c,v 1.20 2007/07/03 05:25:25 lukem Exp $");
__RCSID("$NetBSD: misc.c,v 1.21 2007/10/05 07:23:09 lukem Exp $");
#endif
#endif /* not lint */
@ -47,11 +47,11 @@ __RCSID("$NetBSD: misc.c,v 1.20 2007/07/03 05:25:25 lukem Exp $");
#include <sys/time.h>
#include <err.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <util.h>
#include <inttypes.h>
#include "dd.h"
@ -120,7 +120,6 @@ terminate(int signo)
{
summary();
(void)signal(signo, SIG_DFL);
raise(signo);
/* NOTREACHED */
(void)raise_default_signal(signo);
_exit(127);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: pax.c,v 1.43 2007/07/03 10:20:09 lukem Exp $ */
/* $NetBSD: pax.c,v 1.44 2007/10/05 07:22:23 lukem Exp $ */
/*-
* Copyright (c) 1992 Keith Muller.
@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
#if 0
static char sccsid[] = "@(#)pax.c 8.2 (Berkeley) 4/18/94";
#else
__RCSID("$NetBSD: pax.c,v 1.43 2007/07/03 10:20:09 lukem Exp $");
__RCSID("$NetBSD: pax.c,v 1.44 2007/10/05 07:22:23 lukem Exp $");
#endif
#endif /* not lint */
@ -61,6 +61,7 @@ __RCSID("$NetBSD: pax.c,v 1.43 2007/07/03 10:20:09 lukem Exp $");
#include <string.h>
#include <errno.h>
#include <paths.h>
#include <util.h>
#include "pax.h"
#include "extern.h"
static int gen_init(void);
@ -341,9 +342,6 @@ main(int argc, char **argv)
void
sig_cleanup(int which_sig)
{
struct sigaction n_hand;
sigset_t n_mask;
/*
* restore modes and times for any dirs we may have created
* or any dirs we may have read. Set vflag and vfpart so the user
@ -365,15 +363,7 @@ sig_cleanup(int which_sig)
if (tflag)
atdir_end();
memset(&n_hand, 0, sizeof n_hand);
sigemptyset(&n_hand.sa_mask);
n_hand.sa_handler = SIG_DFL;
if ((sigaction(which_sig, &n_hand, NULL) == 0) &&
(sigemptyset(&n_mask) == 0) &&
(sigaddset(&n_mask, which_sig) == 0) &&
(sigprocmask(SIG_UNBLOCK, &n_mask, 0) == 0)) {
raise(which_sig);
}
(void)raise_default_signal(which_sig);
exit(1);
}

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.8 2007/05/28 12:06:24 tls Exp $
# $NetBSD: Makefile,v 1.9 2007/10/05 07:24:44 lukem Exp $
USE_FORT?= yes # setuid
@ -14,6 +14,9 @@ MLINKS= at.1 batch.1 \
BINOWN= root
BINMODE= 4555
DPADD+= ${LIBUTIL}
LDADD+= -lutil
CWARNFLAGS+= -Wno-format-y2k
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: at.c,v 1.24 2007/07/18 01:13:42 lukem Exp $ */
/* $NetBSD: at.c,v 1.25 2007/10/05 07:24:44 lukem Exp $ */
/*
* at.c : Put file into atrun queue
@ -46,6 +46,7 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <util.h>
#include <locale.h>
/* Local headers */
@ -70,7 +71,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.24 2007/07/18 01:13:42 lukem Exp $");
__RCSID("$NetBSD: at.c,v 1.25 2007/10/05 07:24:44 lukem Exp $");
#endif
#endif
@ -106,22 +107,13 @@ static void process_jobs (int, char **, int);
static void
sigc(int signo)
{
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 */
(void)raise_default_signal(signo);
exit(EXIT_FAILURE);
}