[tor-commits] [tor/master] Write consensus files in binary mode
dgoulet at torproject.org
dgoulet at torproject.org
Tue Feb 12 18:06:28 UTC 2019
commit bbd893d6bd8e79ab6e303152c871027bc0380a38
Author: Nick Mathewson <nickm at torproject.org>
Date: Tue Jan 29 16:18:41 2019 +0100
Write consensus files in binary mode
This will help us out on windows now that we mmap files. Fixes part
of ticket 28614.
---
changes/ticket28614 | 4 ++++
src/feature/nodelist/networkstatus.c | 4 ++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/changes/ticket28614 b/changes/ticket28614
new file mode 100644
index 000000000..c022baf66
--- /dev/null
+++ b/changes/ticket28614
@@ -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.
diff --git a/src/feature/nodelist/networkstatus.c b/src/feature/nodelist/networkstatus.c
index d9659b67c..64169f6a4 100644
--- a/src/feature/nodelist/networkstatus.c
+++ b/src/feature/nodelist/networkstatus.c
@@ -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);
More information about the tor-commits
mailing list