]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix #712: unbound-anchor appears to not fsync root.key.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 22 Oct 2015 07:06:31 +0000 (07:06 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Thu, 22 Oct 2015 07:06:31 +0000 (07:06 +0000)
git-svn-id: file:///svn/unbound/trunk@3512 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
smallapp/unbound-anchor.c
validator/autotrust.c

index 8f6cb5d10fcc21bbdb755aeeb26fea77f029d864..99a5d70c2b53ff8531c8648fa5cce94d3b0d58bb 100644 (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.
index 92bfa842877eaccc9ec8875c4ad5835ac421a176..261c492c15d0de0a30bc28c21712a5925667842f 100644 (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);
 }
 
index e63b086e6a09e32dc8a6e3d95552343c3b055b4e..9c500e08eba08f5c08dc0b2948c693fdfc6a5590 100644 (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));