Hi Martin,

On Mon, 2022-12-19 at 15:21 +0100, Martin Liška wrote:
> > > +      else
> > > +    error (0, 0, "Couldn't get chdr for section %zd", ndx);
> > 
> > Shouldn't this error be fatal?
> 
> What do you use for fatal errors?

Depends a bit on context. It might be that this error isn't fatal, then
zero as first (status) argument is fine, just know that the program
will just continue. And it looked like not all callers were prepared
for this function to return with a bogus return value.

If it is fatal then depending on context you either call error_exit (0,
"Couldn't get chdr for section %zd", ndx); [see system.h, this really
is just error (EXIT_FAILURE, 0, ...)] if the program needs to terminate
right now.

Or you return a special value from the function (assuming all callers
check for an error here). And/Or if the program needs a cleanup you'll
goto cleanup (as is done in process_file).

Cheers,

Mark

Reply via email to