aboutsummaryrefslogtreecommitdiff
path: root/src/feature/control/control.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-10-31 09:04:12 -0400
committerNick Mathewson <nickm@torproject.org>2018-10-31 09:04:12 -0400
commit988d4903a3fc23153896e0daf7738f87ade9bc4b (patch)
tree79f9eb5ca1154c058d5243b0cd43a6ac1905757f /src/feature/control/control.c
parenta182301152afe9cd066516ae02f588840b2efc43 (diff)
parent594140574e7366efac693d440a636a1e1cce82ff (diff)
downloadtor-988d4903a3fc23153896e0daf7738f87ade9bc4b.tar.gz
tor-988d4903a3fc23153896e0daf7738f87ade9bc4b.zip
Merge branch 'networkstatus_mmap' into networkstatus_mmap_merge
Diffstat (limited to 'src/feature/control/control.c')
-rw-r--r--src/feature/control/control.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/feature/control/control.c b/src/feature/control/control.c
index f0db97dc89..3fa47747eb 100644
--- a/src/feature/control/control.c
+++ b/src/feature/control/control.c
@@ -2352,7 +2352,11 @@ getinfo_helper_dir(control_connection_t *control_conn,
*answer = tor_strdup(consensus->dir);
}
if (!*answer) { /* try loading it from disk */
- *answer = networkstatus_read_cached_consensus("ns");
+ tor_mmap_t *mapped = networkstatus_map_cached_consensus("ns");
+ if (mapped) {
+ *answer = tor_memdup_nulterm(mapped->data, mapped->size);
+ tor_munmap_file(mapped);
+ }
if (!*answer) { /* generate an error */
*errmsg = "Could not open cached consensus. "
"Make sure FetchUselessDescriptors is set to 1.";