[Swan] strncpy doesn't do what many people think that it does

Paul Wouters paul at nohats.ca
Fri Feb 15 07:12:51 EET 2013


On Thu, 14 Feb 2013, Wes Hardaker wrote:

>> 	assert(n != 0);		/* won't hold a string! */
>
> Asserts are pure evil in production servers.  They cause important
> software to go down and are an easy spot for denial of service attacks.
> The better thing to do is return an error code, let the above code catch
> and handle it and keep running.

That's what init systems are for. To restart crashed daemons. Aborting
at the first unexpected internal state leads to the best core dumps for
debugging....

So I kinda like asserts. Just returning and logging will get ignored for
years....

Paul


More information about the Swan mailing list