Theo Buehler wrote:
> On Mon, Feb 01, 2016 at 05:17:03PM +0100, Michal Mazurek wrote:
> > Meaningful error messages:
> >
> >             mntbuf = calloc(argc, sizeof(struct statfs));
> >             if (mntbuf == NULL)
> > -                   err(1, NULL);
> > +                   err(1, "calloc");
> 
> I disagree with the changes in this patch.  If either malloc or calloc
> fails it will typically set errno to ENOMEM, so you'll
> 
> df: Cannot allocate memory
> 
> I don't think adding the information that it was malloc or calloc that
> failed is helpful at all.

Seconded.

IIUC, the only cause of an error other than ENOMEM is a bug in the
allocator. This will definitely or almost definitely happen in a part of
the allocator that is agnostic to the function called (malloc, calloc,
etc.). So printing the function name is just noise.

Reply via email to