From: Wouter Wijngaards Date: Tue, 21 Jan 2014 10:14:55 +0000 (+0000) Subject: - Fix #547: no trustanchor written if filesystem full, fclose checked. X-Git-Tag: release-1.4.22rc1~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bb8f893cc5900da2f1be937b22e2467e2799bed;p=thirdparty%2Funbound.git - Fix #547: no trustanchor written if filesystem full, fclose checked. git-svn-id: file:///svn/unbound/trunk@3044 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index fa9578d96..81ae43b93 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,6 @@ +21 January 2014: Wouter + - Fix #547: no trustanchor written if filesystem full, fclose checked. + 17 January 2014: Wouter - Fix isprint() portability in sldns, uses unsigned int. - iana portlist updated. diff --git a/validator/autotrust.c b/validator/autotrust.c index c848d427f..0c0b84eaa 100644 --- a/validator/autotrust.c +++ b/validator/autotrust.c @@ -1195,8 +1195,13 @@ void autr_write_file(struct module_env* env, struct trust_anchor* tp) log_err("could not completely write: %s", fname); return; } + if(fclose(out) != 0) { + log_err("could not complete write: %s: %s", + fname, strerror(errno)); + unlink(tempf); + return; + } /* success; overwrite actual file */ - fclose(out); verbose(VERB_ALGO, "autotrust: replaced %s", fname); #ifdef UB_ON_WINDOWS (void)unlink(fname); /* windows does not replace file with rename() */