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
This commit is contained in:
Ian Dowse 2004-02-08 21:59:17 +00:00
parent 5bb0c94f9d
commit c8bb99e577

View File

@ -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;
}