Alex Henrie : ping: Distinguish between timeouts and other failures.
Module: wine Branch: master Commit: d3dc6f900a4002b19a1fc06de7a9e02811ff79f7 URL: https://source.winehq.org/git/wine.git/?a=commit;h=d3dc6f900a4002b19a1fc06de... Author: Alex Henrie <alexhenrie24(a)gmail.com> Date: Wed Mar 7 22:02:13 2018 -0700 ping: Distinguish between timeouts and other failures. Signed-off-by: Alex Henrie <alexhenrie24(a)gmail.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- programs/ping/ping_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/programs/ping/ping_main.c b/programs/ping/ping_main.c index 74a1c71..9c4f239 100644 --- a/programs/ping/ping_main.c +++ b/programs/ping/ping_main.c @@ -157,6 +157,7 @@ int main(int argc, char** argv) printf("Pinging %s [%s] with %d bytes of data:\n", hostname, ip, l); for (;;) { + SetLastError(0); retval = IcmpSendEcho(icmp_file, ipaddr, send_data, l, NULL, reply_buffer, reply_size, w); if (retval != 0) @@ -177,7 +178,10 @@ int main(int argc, char** argv) } else { - printf("Request timed out.\n"); + if (GetLastError() == IP_REQ_TIMED_OUT) + puts("Request timed out."); + else + puts("PING: transmit failed. General failure."); lost++; } i++;
participants (1)
-
Alexandre Julliard