avoid linux 2.6.14 was: Re: 9.3.2b1 errno2result.c:109: unexpected error: unable to convert errno to isc_result: 14: Bad address

Paul Vixie paul at vix.com
Fri Nov 4 14:45:39 UTC 2005

# > 	if (len <= 0)
# > 		return 0;
# You'll need to ask Herbert Xu <herbert at gondor.apana.org.au> about it for he
# wrote this patch. All i know is that it fixes this kernel bug and that this
# integer in particular is very unlikely to be < 0 as it represents the udp
# packets payload length, but i can see your point here.

i don't.  under those conditions, the right code is:

	assert(len >= 0);
	if (len == 0)
		return (0);

folding impossible values into an error return is part of how code festers.

though i agree that "if (!len)" is bad code since len is not a boolean --
code should look as much as possible like what it means, not just what it does.

> I would stay away from any software and O/S that considered good coding
> practice.

alas, critical mass trumps correctness or elegance when it comes to my
desktop.  if the platforms that other people are writing desktop apps for
are all full of bad code like this, i still have to run such a platform.
(thankfully my desktops are all behind strong firewalls.)  i'm willing to
write or audit, or hire people to write or audit, my server apps.  when it
comes to desktop apps that's just untenable.

More information about the bind-workers mailing list