On Thu, Mar 09, 2017 at 03:21:03PM +0000, Pedro F. Giffuni wrote:
>  void
> +delete_category(FILE *f)
> +{
> +     (void) fclose(f);
> +     (void) unlink(category_file());
> +}
> +
> +void
>  close_category(FILE *f)
>  {
> -     if (fchmod(fileno(f), 0644) < 0) {
> +     if (fchmod(fileno(f), 0644) < 0 ||
> +         fclose(f) != 0) {
>               (void) fclose(f);
>               (void) unlink(category_file());
>               errf(strerror(errno));
> +             delete_category(f);
>       }
If you look carefully, there are too many fclose() there: one optional in
the condition, then unconditional fclose() even if one in the condition
failed, and then one more in delete_category().
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to