]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix #547: no trustanchor written if filesystem full, fclose checked.
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 21 Jan 2014 10:14:55 +0000 (10:14 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Tue, 21 Jan 2014 10:14:55 +0000 (10:14 +0000)
git-svn-id: file:///svn/unbound/trunk@3044 be551aaa-1e26-0410-a405-d3ace91eadb9

doc/Changelog
validator/autotrust.c

index fa9578d966787fd3812d4351f44323b7f789144f..81ae43b93c4fc46337260f50fa815b4805024508 100644 (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.
index c848d427fb6181d33ef04e75baa992c05bfc5a41..0c0b84eaa2de9c7eb70ad801cfc78e485fa9604f 100644 (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() */