On Sun, 06 Feb 2022 23:41:26 -0600, Scott Cheloha wrote:

> > On Feb 6, 2022, at 20:07, Todd C. Miller <[email protected]> wrote:
> > 
> > Since the input is opened read-only I don't see the point in checking
> > the fclose() return value.  However, if you are going to do so, you
> > might as well combine it with the ferror() check.  E.g.
> > 
> >    if (ferror(fp) || fclose(fp) == EOF) {
> >        warn("%s", name);
> >        status = 1;
> >    }
>
> If we do that, we leak fp when there is an
> input error.

True.  I think you are better off just not checking the fclose()
return value.  If there was an actual read error, ferror() would
have caught it.

 - todd

Reply via email to