From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Wed, 22 Aug 2012 09:05:20 -0400 To: 9fans@9fans.net Message-ID: In-Reply-To: <7920067cf9fa2325929e33f0fdb11352@rei2.9hal> References: <7920067cf9fa2325929e33f0fdb11352@rei2.9hal> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] dns Topicbox-Message-UUID: ada46428-ead7-11e9-9d60-3106f5b1d025 On Wed Aug 22 08:38:51 EDT 2012, cinap_lenrek@gmx.de wrote: > look closely at: > > > qp->curdest = &qp->dest[j]; > > this just takes the address, it doesnt actually dereference anything. you > could write this as qp->curdest = qp->dest + j. > > that destck(qp->curdest); call and the j >= Maxdest check after the > serveraddrs() call seem like a confused debug attempt to me. or is here > any reason why serveraddrs() should *not* fill the whole array up > to the last element and stop at Maxdest-2? it will stop at setting qp->curdest = &qp->dest[Maxdest-1], since the maximum return value is the loop limit + 1. since qb->curdest is indirected, for example by setdestoutns, this must be a valid pointer to remain safe. and further, after failing to get an answer from 24 different servers, it's unlikely that the 25th will trying 24 different servers for the same address is already i think it should be smaller. but that's just me. :-). i think we can all agree that this code is hard to read. - erik