1 Submitted By: Jim Gifford (patches at jg555 dot com)
3 Initial Package Version: 1.4.2
5 Description: Fixes Ping Errors
6 If you try to only send one ping, it will not stop
7 until it gets a response.
9 diff -Naur inetutils-1.4.2.orig/ping/ping.c inetutils-1.4.2/ping/ping.c
10 --- inetutils-1.4.2.orig/ping/ping.c 2002-12-11 12:38:00.000000000 +0000
11 +++ inetutils-1.4.2/ping/ping.c 2003-09-10 16:13:14.000000000 +0000
13 struct timeval last, intvl, now;
14 struct timeval *t = NULL;
19 signal (SIGINT, sig_int);
21 fdmax = ping->ping_fd+1;
23 if ((n = select (fdmax, &fdset, NULL, NULL, &timeout)) < 0)
26 - perror ("ping: select");
32 - len = ping_recv (ping);
33 + if (ping_recv (ping) == 0)
37 gettimeofday (&now, NULL);
40 - if (ping->ping_count && ping->ping_num_recv >= ping->ping_count)
41 + if (ping->ping_count && nresp >= ping->ping_count)
46 - if (!ping->ping_count || ping->ping_num_recv < ping->ping_count)
47 + if (!ping->ping_count || ping->ping_num_xmit < ping->ping_count)
50 if (!(options & OPT_QUIET) && options & OPT_FLOOD)
59 intvl.tv_sec = MAXWAIT;
60 diff -Naur inetutils-1.4.2.orig/ping/ping_echo.c inetutils-1.4.2/ping/ping_echo.c
61 --- inetutils-1.4.2.orig/ping/ping_echo.c 2002-06-26 03:15:06.000000000 +0000
62 +++ inetutils-1.4.2/ping/ping_echo.c 2003-09-10 16:19:11.000000000 +0000
72 out->tv_sec -= in->tv_sec;
78 + return (a < 0) ? -a : a;
82 +nsqrt (double a, double prec)
94 + x1 = (x0 + a/x0) / 2;
96 + while (nabs (x1 - x0) > prec);
103 @@ -596,10 +620,10 @@
104 double vari = ping_stat->tsumsq / total - avg * avg;
106 printf ("round-trip min/avg/max/stddev = %.3f/%.3f/%.3f/%.3f ms\n",
114 + nsqrt (vari, 0.0005));
116 exit (ping->ping_num_recv == 0);