diff options
-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; |