diff --git a/Userland/Utilities/ping.cpp b/Userland/Utilities/ping.cpp index c8782b85dd..825608112d 100644 --- a/Userland/Utilities/ping.cpp +++ b/Userland/Utilities/ping.cpp @@ -152,17 +152,17 @@ ErrorOr serenity_main(Main::Arguments arguments) struct timeval tv_send; gettimeofday(&tv_send, nullptr); + if (count && total_pings == count) + closing_statistics(); + else + total_pings++; + rc = sendto(fd, ping_packet.data(), ping_packet.size(), 0, (const struct sockaddr*)&peer_address, sizeof(sockaddr_in)); if (rc < 0) { perror("sendto"); return 1; } - if (count && total_pings == count) - closing_statistics(); - else - total_pings++; - for (;;) { auto pong_packet_result = ByteBuffer::create_uninitialized( sizeof(struct ip) + max_optional_header_size_in_bytes + sizeof(struct icmphdr) + payload_size);