aboutsummaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorRuslan Ermilov <ru@FreeBSD.org>2002-01-14 14:33:35 +0000
committerRuslan Ermilov <ru@FreeBSD.org>2002-01-14 14:33:35 +0000
commit32af342f5859a30002bdbfd3f82b1e1390b95fc9 (patch)
tree0942bfb281dc16b2a144b79309008b745815901d /sbin
parent296596145c9fe585b49d267dc7cee09b6cfef670 (diff)
downloadsrc-32af342f5859a30002bdbfd3f82b1e1390b95fc9.tar.gz
src-32af342f5859a30002bdbfd3f82b1e1390b95fc9.zip
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
Notes
Notes: svn path=/head/; revision=89349
Diffstat (limited to 'sbin')
-rw-r--r--sbin/ping/ping.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sbin/ping/ping.c b/sbin/ping/ping.c
index 0c6b3cbc32fd..302ab98bd342 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;