use proper loop constructs rather than goto's
Subsystems (2)
a bunch of places in the tracepath code use goto's rather than real loop code, or goto's to jump out of loop's ... some versions (like gcc-3.3.x iirc, older admittedly) would miscompile this and it's cleaner anyways to just use real loops
the attached patch isnt applicable as is (style changes required mostly) as i just want to see if people will accept it or the answer is "upgrade your gcc to like 4.1.x"
-mike
use proper looping code rather than labels/gotos as some versions of gcc may miscompile the code.
Signed-off-by Robert Moss <[email protected]>
Signed-off-by Mike Frysinger <[email protected]>
tracepath.c +5 -5
@@ -77,7 +77,7 @@ int recverr(int fd, int ttl)int progress =-1 ;int broken_router; -restart: +while (1 ) {memset (&rcvbuf,-1 ,sizeof (rcvbuf)); iov.iov_base = &rcvbuf; iov.iov_len =sizeof (rcvbuf);
@@ -94,7 +94,7 @@ restart:if (res <0 ) {if (errno ==EAGAIN )return progress; - goto restart; +continue ; } progress = mtu;
@@ -217,7 +217,7 @@ restart:perror ("NET ERROR" );return 0 ; } - goto restart; + } }int probe_ttl (int fd,int ttl)
@@ -228,7 +228,6 @@ int probe_ttl(int fd, int ttl)memset (sndbuf,0 ,mtu); -restart:for (i=0 ; i<10 ; i++) {int res;
@@ -244,7 +243,8 @@ restart:if (res==0 )return 0 ;if (res >0 ) - goto restart; + i =0 ; +continue ; } hisptr = (hisptr +1 )&63 ;
tracepath6.c +19 -24
74 lines not on this page · raw message