summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
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 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;
OpenPOWER on IntegriCloud