1 use proper looping code rather than labels/gotos as some versions of
2 gcc may miscompile the code.
4 Signed-off-by: Robert Moss <robmoss@gentoo.org>
5 Signed-off-by: Mike Frysinger <robmoss@gentoo.org>
7 diff --git a/tracepath.c b/tracepath.c
8 index c3f6f74..7ff85a2 100644
11 @@ -77,7 +77,7 @@ int recverr(int fd, int ttl)
17 memset(&rcvbuf, -1, sizeof(rcvbuf));
18 iov.iov_base = &rcvbuf;
19 iov.iov_len = sizeof(rcvbuf);
20 @@ -94,7 +94,7 @@ restart:
29 @@ -217,7 +217,7 @@ restart:
37 int probe_ttl(int fd, int ttl)
38 @@ -228,7 +228,6 @@ int probe_ttl(int fd, int ttl)
43 for (i=0; i<10; i++) {
46 @@ -244,7 +243,8 @@ restart:
54 hisptr = (hisptr + 1)&63;
56 diff --git a/tracepath6.c b/tracepath6.c
57 index 23d6a8c..6d2a95b 100644
60 @@ -71,7 +71,7 @@ int recverr(int fd, int ttl)
66 memset(&rcvbuf, -1, sizeof(rcvbuf));
67 iov.iov_base = &rcvbuf;
68 iov.iov_len = sizeof(rcvbuf);
69 @@ -88,7 +88,7 @@ restart:
78 @@ -233,34 +233,29 @@ restart:
86 int probe_ttl(int fd, int ttl)
91 struct probehdr *hdr = (struct probehdr*)sndbuf;
95 - for (i=0; i<10; i++) {
99 - gettimeofday(&hdr->tv, NULL);
100 - if (send(fd, sndbuf, mtu-overhead, 0) > 0)
102 - res = recverr(fd, ttl);
113 + for (i=0; i<10; i++) {
115 + gettimeofday(&hdr->tv, NULL);
116 + if (send(fd, sndbuf, mtu-overhead, 0) > 0)
118 + res = recverr(fd, ttl);
127 if (recv(fd, sndbuf, sizeof(sndbuf), MSG_DONTWAIT) > 0) {
128 printf("%2d?: reply received 8)\n", ttl);
129 @@ -268,7 +263,7 @@ restart:
131 res = recverr(fd, ttl);