Write consensus files in binary mode

This will help us out on windows now that we mmap files.  Fixes part
of ticket 28614.
This commit is contained in:
Nick Mathewson 2019-01-29 16:18:41 +01:00
parent d9010c5b67
commit bbd893d6bd
2 changed files with 6 additions and 2 deletions

4
changes/ticket28614 Normal file
View File

@ -0,0 +1,4 @@
o Major bugfixes (windows, startup):
- When writing a consensus file to disk, always write in
"binary" mode so that we can safely map it into memory later.
Fixes part bug 28614; bugfix on 0.4.0.1-alpha.

View File

@ -1991,7 +1991,7 @@ networkstatus_set_current_consensus(const char *consensus,
waiting->set_at = now;
waiting->dl_failed = 0;
if (!from_cache) {
write_bytes_to_file(unverified_fname, consensus, consensus_len, 0);
write_bytes_to_file(unverified_fname, consensus, consensus_len, 1);
}
if (dl_certs)
authority_certs_fetch_missing(c, now, source_dir);
@ -2142,7 +2142,7 @@ networkstatus_set_current_consensus(const char *consensus,
}
if (!from_cache) {
write_bytes_to_file(consensus_fname, consensus, consensus_len, 0);
write_bytes_to_file(consensus_fname, consensus, consensus_len, 1);
}
warn_early_consensus(c, flavor, now);