diff options
author | ru <ru@FreeBSD.org> | 2002-01-14 14:33:35 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2002-01-14 14:33:35 +0000 |
commit | 85fa9723af36983db89be0e1186971d7471b0994 (patch) | |
tree | 0942bfb281dc16b2a144b79309008b745815901d /sbin/ping | |
parent | 2f096f0e0a79ddff4903a120ec80f1106c904ea3 (diff) | |
download | FreeBSD-src-85fa9723af36983db89be0e1186971d7471b0994.zip FreeBSD-src-85fa9723af36983db89be0e1186971d7471b0994.tar.gz |
Fixed two bugs with the "-l preload" option:
- first ping after a preload was sent undelayed
- we could send more than -c packets in preload
PR: bin/32354
Diffstat (limited to 'sbin/ping')
-rw-r--r-- | sbin/ping/ping.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c index 0c6b3cb..302ab98 100644 --- a/sbin/ping/ping.c +++ b/sbin/ping/ping.c @@ -620,8 +620,15 @@ main(argc, argv) tcsetattr(STDOUT_FILENO, TCSANOW, &ts); } - while (preload--) /* fire off them quickies */ - pinger(); + if (preload == 0) + pinger(); /* send the first ping */ + else { + if (npackets != 0 && preload > npackets) + preload = npackets; + while (preload--) /* fire off them quickies */ + pinger(); + } + (void)gettimeofday(&last, NULL); if (options & F_FLOOD) { intvl.tv_sec = 0; @@ -631,9 +638,6 @@ main(argc, argv) intvl.tv_usec = interval % 1000 * 1000; } - pinger(); /* send the first ping */ - (void)gettimeofday(&last, NULL); - while (!finish_up) { register int cc; int n; |