diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-10-31 09:04:12 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-10-31 09:04:12 -0400 |
commit | 988d4903a3fc23153896e0daf7738f87ade9bc4b (patch) | |
tree | 79f9eb5ca1154c058d5243b0cd43a6ac1905757f /src/feature/control/control.c | |
parent | a182301152afe9cd066516ae02f588840b2efc43 (diff) | |
parent | 594140574e7366efac693d440a636a1e1cce82ff (diff) | |
download | tor-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.c | 6 |
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."; |