Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Mar 2017 19:54:46 +0200
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        "Pedro F. Giffuni" <pfg@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r314961 - head/usr.bin/localedef
Message-ID:  <20170309175446.GD16105@kib.kiev.ua>
In-Reply-To: <201703091521.v29FL3da010200@repo.freebsd.org>
References:  <201703091521.v29FL3da010200@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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().



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170309175446.GD16105>