From 05e08e2967a32ac8b18a8b142353490941ed489c Mon Sep 17 00:00:00 2001 From: iedowse Date: Sun, 8 Feb 2004 21:59:17 +0000 Subject: 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 --- sbin/ping/ping.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sbin/ping') 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; } -- cgit v1.1