Subject: Re: error handling functions again...
To: Christos Zoulas <>
From: Elad Efrat <>
List: tech-userlevel
Date: 08/26/2006 02:39:00
Christos Zoulas wrote:

> Based on suggestions from other people I have made the following changes
> to the error handling wrappers:
>   - moved the decls from <err.h> to <util.h>
>   - don't print the strings
>   - provide a function to control printing of errors.
> The diff is on
> Please let me know what you think.

Looks great, except that you need to change ecalloc() to use calloc()
rather than malloc(), otherwise you lose the integer overflow
protection. Use this:

void *
ecalloc(size_t n, size_t s)
	void *p = calloc(n, s);
	if (p == NULL)
		(*efunc)(1, "Cannot allocate %zu bytes", n);
	return p;


Elad Efrat