In the SIGINT handler, explicitly display a summary and then raise the

default SIGINT handler to exit, rather than exit(0) and relying upon the
atexit() to display the summary.
Per SUS6.
This commit is contained in:
lukem 2007-07-03 05:25:25 +00:00
parent 84684ff767
commit 4cac80e3e4
1 changed files with 7 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: misc.c,v 1.19 2004/01/17 20:48:57 dbj Exp $ */
/* $NetBSD: misc.c,v 1.20 2007/07/03 05:25:25 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.19 2004/01/17 20:48:57 dbj Exp $");
__RCSID("$NetBSD: misc.c,v 1.20 2007/07/03 05:25:25 lukem Exp $");
#endif
#endif /* not lint */
@ -47,6 +47,7 @@ __RCSID("$NetBSD: misc.c,v 1.19 2004/01/17 20:48:57 dbj Exp $");
#include <sys/time.h>
#include <err.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -115,9 +116,11 @@ summaryx(int notused)
/* ARGSUSED */
void
terminate(int notused)
terminate(int signo)
{
exit(0);
summary();
(void)signal(signo, SIG_DFL);
raise(signo);
/* NOTREACHED */
}