Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/ping6 PR/49206: ping6 dies with SIGINT even when it jus...



details:   https://anonhg.NetBSD.org/src/rev/20bf3b965164
branches:  trunk
changeset: 332334:20bf3b965164
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Sep 16 21:29:12 2014 +0000

description:
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.

diffstat:

 sbin/ping6/ping6.c |  21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diffs (69 lines):

diff -r 41da2f89e48d -r 20bf3b965164 sbin/ping6/ping6.c
--- a/sbin/ping6/ping6.c        Tue Sep 16 17:23:50 2014 +0000
+++ b/sbin/ping6/ping6.c        Tue Sep 16 21:29:12 2014 +0000
@@ -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 @@
 #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 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 @@
                        continue;
                }
                if (seenint) {
-                       onint(SIGINT);
+                       onsigexit(SIGINT);
                        seenint = 0;
                        continue;
                }
@@ -1154,7 +1154,7 @@
        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 @@
 }
 
 /*
- * 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);



Home | Main Index | Thread Index | Old Index