[ccan] RFC: draft rfc822 module
Jonathan Nieder
jrnieder at gmail.com
Mon May 21 20:59:31 EST 2012
David Gibson wrote:
> On Sun, May 20, 2012 at 09:38:09PM -0500, Jonathan Nieder wrote:
>> David Gibson wrote:
>>> --- /dev/null
>>> +++ b/ccan/rfc822/test/run-allocation-failure.c
>>> @@ -0,0 +1,56 @@
>> [...]
>>> + talloc_set_allocator(failing_malloc, free, realloc);
>>
>> By the way, as an alternative to the rfc822 allocation failure
>> callback, I can set up exit-cleanly-on-failed-allocation semantics
>> here. I can even use talloc_add_external to make my handler's
>> behavior depend on the talloc context.
>
> Um.. I'm not sure what you mean by this.
Sorry, thinko on my part.
What I meant is that a caller who wants to exit(1) instead of abort()
for allocation failures can make talloc take care of that, using
talloc_set_allocator() or talloc_add_external().
The thinko was that if the caller wants to suppress the abort() but
does not want to exit, this trick isn't enough. It can't replace the
functionality of the rfc822 failed allocation handler completely.
Drat, error handling is _hard_.
Thanks for your thoughtfulness.
Jonathan
More information about the ccan
mailing list