change to break vs return

tridge at samba.org tridge at samba.org
Mon Nov 29 19:33:53 MST 2010


Hi Matthias,

Your patch 54a5c398aaa1d53b5892c9b0aa5539ae7da651da creates an
infinite loop. Please revert.

 > diff --git a/source4/torture/basic/base.c b/source4/torture/basic/base.c
 > index 9953573..0e168ed 100644
 > --- a/source4/torture/basic/base.c
 > +++ b/source4/torture/basic/base.c
 > @@ -1340,7 +1340,7 @@ static bool run_iometer(struct torture_context *tctx,
 >  		for (i=0; i<num_reads; i++) {
 >  			ssize_t res;
 >  			if (ops++ > torture_numops) {
 > -				return true;
 > +				break;

this break only breaks out of the for loop, not for surrounding while
loop, so your change means that this code now never returns, whereas
it used to return on a loop limit.

Can I suggest that you walk through your code changes with gdb before
pushing? Also, a number of us have suggested that you ask for review
before you push changes. Did you get anyone to review this?

Cheers, Tridge


More information about the samba-technical mailing list