- Fix #547: no trustanchor written if filesystem full, fclose checked.

git-svn-id: file:///svn/unbound/trunk@3044 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2014-01-21 10:14:55 +00:00
parent ef06e9062e
commit 2bb8f893cc
2 changed files with 9 additions and 1 deletions

View file

@ -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.

View file

@ -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() */