- Fix #712: unbound-anchor appears to not fsync root.key.

git-svn-id: file:///svn/unbound/trunk@3512 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2015-10-22 07:06:31 +00:00
parent 14bad4293a
commit 40c139cd8f
3 changed files with 11 additions and 0 deletions

View file

@ -1,3 +1,6 @@
22 October 2015: Wouter
- Fix #712: unbound-anchor appears to not fsync root.key.
20 October 2015: Wouter
- 1.5.6 release.
- trunk tracks development of 1.5.7.

View file

@ -1828,6 +1828,8 @@ write_unsigned_root(const char* root_anchor_file)
root_anchor_file);
if(verb && errno != 0) printf("%s\n", strerror(errno));
}
fflush(out);
fsync(fileno(out));
fclose(out);
}
@ -1854,6 +1856,8 @@ write_root_anchor(const char* root_anchor_file, BIO* ds)
root_anchor_file);
if(verb && errno != 0) printf("%s\n", strerror(errno));
}
fflush(out);
fsync(fileno(out));
fclose(out);
}

View file

@ -1195,6 +1195,10 @@ void autr_write_file(struct module_env* env, struct trust_anchor* tp)
fatal_exit("could not completely write: %s", fname);
return;
}
if(fflush(out) != 0)
log_err("could not fflush(%s): %s", fname, strerror(errno));
if(fsync(fileno(out)) != 0)
log_err("could not fsync(%s): %s", fname, strerror(errno));
if(fclose(out) != 0) {
fatal_exit("could not complete write: %s: %s",
fname, strerror(errno));