From: Keith Bostic Date: Thu, 17 Aug 1989 05:23:24 +0000 (-0800) Subject: don't wait for packets on SIGINTR, just die X-Git-Tag: BSD-4_3_Reno-Snapshot-Development~5786 X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/commitdiff_plain/c19f4b1ff2e181109bb56931b3499136d6383f18 don't wait for packets on SIGINTR, just die SCCS-vsn: sbin/ping/ping.c 5.2 --- diff --git a/usr/src/sbin/ping/ping.c b/usr/src/sbin/ping/ping.c index 9dd4ff3e43..b1cc1e2ce0 100644 --- a/usr/src/sbin/ping/ping.c +++ b/usr/src/sbin/ping/ping.c @@ -25,7 +25,7 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)ping.c 5.1 (Berkeley) %G%"; +static char sccsid[] = "@(#)ping.c 5.2 (Berkeley) %G%"; #endif /* not lint */ /* @@ -122,7 +122,7 @@ u_long tsum; /* sum of all times, for doing average */ u_long inet_addr(); char *inet_ntoa(), *pr_addr(); -int catcher(), finish(), prefinish(); +int catcher(), finish(); main(argc, argv) int argc; @@ -314,7 +314,7 @@ main(argc, argv) else (void)printf("PING %s: %d data bytes\n", hostname, datalen); - (void)signal(SIGINT, prefinish); + (void)signal(SIGINT, finish); (void)signal(SIGALRM, catcher); while (preload--) /* fire off them quickies */ @@ -669,26 +669,13 @@ tvsub(out, in) out->tv_sec -= in->tv_sec; } -/* - * prefinish -- - * On the first SIGINT, allow any outstanding packets to dribble in. - */ -prefinish() -{ - /* quit now if caught up or if remote is dead */ - if (!nreceived || nreceived >= ntransmitted) - finish(); - - /* do this only the 1st time, let the normal limit work */ - (void)signal(SIGINT, finish); - npackets = ntransmitted + 1; -} /* * finish -- * Print out statistics, and give up. */ finish() { + (void)signal(SIGINT, SIG_IGN); (void)putchar('\n'); (void)fflush(stdout); (void)printf("--- %s ping statistics ---\n", hostname);