summaryrefslogtreecommitdiffstats
path: root/sbin/ping/ping.c
diff options
context:
space:
mode:
authorsteve <steve@FreeBSD.org>1998-05-25 06:53:17 +0000
committersteve <steve@FreeBSD.org>1998-05-25 06:53:17 +0000
commit34a920572baedd563bfa0047ba0ec2fbc9096835 (patch)
treeb4099fc457f2863971ed8cd64f10dbc10a9b8354 /sbin/ping/ping.c
parent75cfd8e8c24f9fed2f2572f809bbae041a544e39 (diff)
downloadFreeBSD-src-34a920572baedd563bfa0047ba0ec2fbc9096835.zip
FreeBSD-src-34a920572baedd563bfa0047ba0ec2fbc9096835.tar.gz
Revert the previous fix. As it turns out Warner Losh is
working a better fix.
Diffstat (limited to 'sbin/ping/ping.c')
-rw-r--r--sbin/ping/ping.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index a0ef901..7b2e09b 100644
--- a/sbin/ping/ping.c
+++ b/sbin/ping/ping.c
@@ -45,7 +45,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93";
*/
static const char rcsid[] =
- "$Id: ping.c,v 1.34 1998/05/16 00:19:27 jb Exp $";
+ "$Id: ping.c,v 1.35 1998/05/25 03:50:51 steve Exp $";
#endif /* not lint */
/*
@@ -161,7 +161,6 @@ double tsumsq = 0.0; /* sum of all times squared, for std. dev. */
volatile sig_atomic_t finish_up; /* nonzero if we've been told to finish up */
int reset_kerninfo;
volatile sig_atomic_t siginfo_p;
-volatile time_t lasttime;
static void fill(char *, char *);
static u_short in_cksum(u_short *, int);
@@ -213,7 +212,6 @@ main(argc, argv)
uid = getuid();
preload = 0;
- lasttime = 0;
datap = &outpack[8 + PHDR_LEN];
while ((ch = getopt(argc, argv, "I:LQRT:c:adfi:l:np:qrs:v")) != -1) {
@@ -523,29 +521,19 @@ catcher(int sig)
{
int waittime;
struct sigaction si_sa;
- time_t timenow;
-
- if (nreceived) {
- waittime = 2 * tmax / 1000;
- if (!waittime)
- waittime = 1;
- } else
- waittime = MAXWAIT;
-
- /*
- * Die if SIGALRM is caught earlier than it should have been. This
- * is usually the result of someone sending thousands of SIGALRMs
- * in an attempt to simulate a ping -f (flood).
- */
- if(time((time_t *)&timenow) < lasttime + waittime)
- exit(0);
- lasttime = timenow;
pinger();
-
+
if (!npackets || ntransmitted < npackets)
(void)alarm((u_int)interval);
else {
+ if (nreceived) {
+ waittime = 2 * tmax / 1000;
+ if (!waittime)
+ waittime = 1;
+ } else
+ waittime = MAXWAIT;
+
si_sa.sa_handler = stopit;
sigemptyset(&si_sa.sa_mask);
si_sa.sa_flags = 0;
OpenPOWER on IntegriCloud