Module Name: src
Committed By: christos
Date: Tue Sep 16 21:29:13 UTC 2014
Modified Files:
src/sbin/ping6: ping6.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sbin/ping6/ping6.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/ping6/ping6.c
diff -u src/sbin/ping6/ping6.c:1.83 src/sbin/ping6/ping6.c:1.84
--- src/sbin/ping6/ping6.c:1.83 Fri Aug 22 16:54:29 2014
+++ src/sbin/ping6/ping6.c Tue Sep 16 17:29:12 2014
@@ -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 (
#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 timeva
}
/*
- * 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);