svn commit: r314961 - head/usr.bin/localedef
Konstantin Belousov
kostikbel at gmail.com
Thu Mar 9 17:54:52 UTC 2017
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().
More information about the svn-src-head
mailing list