PR/49206: ping6 dies with SIGINT even when it just fails to ping
When reusing the same handler for SIGALRM, make don't pretend you got SIGINT.
This commit is contained in:
parent
17d648a1fc
commit
6b3fd816dd
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ping6.c,v 1.83 2014/08/22 20:54:29 matt Exp $ */
|
||||
/* $NetBSD: ping6.c,v 1.84 2014/09/16 21:29:12 christos Exp $ */
|
||||
/* $KAME: ping6.c,v 1.164 2002/11/16 14:05:37 itojun Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -77,7 +77,7 @@ static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93";
|
|||
#else
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: ping6.c,v 1.83 2014/08/22 20:54:29 matt Exp $");
|
||||
__RCSID("$NetBSD: ping6.c,v 1.84 2014/09/16 21:29:12 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -255,7 +255,7 @@ static int get_pathmtu(struct msghdr *);
|
|||
static struct in6_pktinfo *get_rcvpktinfo(struct msghdr *);
|
||||
static void onsignal(int);
|
||||
static void retransmit(void);
|
||||
__dead static void onint(int);
|
||||
__dead static void onsigexit(int);
|
||||
static size_t pingerlen(void);
|
||||
static int pinger(void);
|
||||
static const char *pr_addr(struct sockaddr *, int);
|
||||
|
@ -1032,7 +1032,7 @@ main(int argc, char *argv[])
|
|||
continue;
|
||||
}
|
||||
if (seenint) {
|
||||
onint(SIGINT);
|
||||
onsigexit(SIGINT);
|
||||
seenint = 0;
|
||||
continue;
|
||||
}
|
||||
|
@ -1154,7 +1154,7 @@ retransmit(void)
|
|||
itimer.it_interval.tv_usec = 0;
|
||||
itimer.it_value.tv_usec = 0;
|
||||
|
||||
(void)signal(SIGALRM, onint);
|
||||
(void)signal(SIGALRM, onsigexit);
|
||||
(void)setitimer(ITIMER_REAL, &itimer, NULL);
|
||||
}
|
||||
|
||||
|
@ -2055,17 +2055,18 @@ tvsub(struct timeval *out, struct timeval *in)
|
|||
}
|
||||
|
||||
/*
|
||||
* onint --
|
||||
* SIGINT handler.
|
||||
* onsigexit --
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
static void
|
||||
onint(int notused)
|
||||
onsigexit(int sig)
|
||||
{
|
||||
summary();
|
||||
|
||||
(void)signal(SIGINT, SIG_DFL);
|
||||
(void)kill(getpid(), SIGINT);
|
||||
if (sig == SIGINT) {
|
||||
(void)signal(SIGINT, SIG_DFL);
|
||||
(void)kill(getpid(), SIGINT);
|
||||
}
|
||||
|
||||
/* NOTREACHED */
|
||||
exit(1);
|
||||
|
|
Loading…
Reference in New Issue