summaryrefslogtreecommitdiffstats
path: root/sbin/ping
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2004-02-08 21:59:17 +0000
committeriedowse <iedowse@FreeBSD.org>2004-02-08 21:59:17 +0000
commit05e08e2967a32ac8b18a8b142353490941ed489c (patch)
tree6cc8c3343820f52a3c4c9dc8adea223b41d0244c /sbin/ping
parent204305ab35f75f0199483ef51e23938788cc5c21 (diff)
downloadFreeBSD-src-05e08e2967a32ac8b18a8b142353490941ed489c.zip
FreeBSD-src-05e08e2967a32ac8b18a8b142353490941ed489c.tar.gz
Certain ICMP error replies cause ping to perform a reverse DNS
lookup on an IP address from the packet (such as the IP that sent a TTL exceeded error). If the DNS lookup takes a long time, ^C will appear to be ineffective since the SIGINT handler just sets a flag and returns. Work around this by exiting immediately on receipt of a second SIGINT when DNS lookups are enabled. PR: bin/4696 MFC after: 1 week
Diffstat (limited to 'sbin/ping')
-rw-r--r--sbin/ping/ping.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index cf01858..8db4afe 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -830,6 +830,12 @@ stopit(sig)
int sig __unused;
{
+ /*
+ * When doing reverse DNS lookups, the finish_up flag might not
+ * be noticed for a while. Just exit if we get a second SIGINT.
+ */
+ if (!(options & F_NUMERIC) && finish_up)
+ _exit(nreceived ? 0 : 2);
finish_up = 1;
}
OpenPOWER on IntegriCloud