aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-11-21 12:36:32 -0500
committerNick Mathewson <nickm@torproject.org>2017-11-21 12:36:32 -0500
commitea13a47791c1a6b50fed27322a073c54868ac738 (patch)
treecd1de0fb6d6ed7ec2fbc7c1a3a89701ad348a9ab
parentc8ee12b2e8108658d647aedb92885311291b6f71 (diff)
downloadtor-ea13a47791c1a6b50fed27322a073c54868ac738.tar.gz
tor-ea13a47791c1a6b50fed27322a073c54868ac738.zip
add an explanatory comment about the error codes
-rw-r--r--src/or/conscache.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/or/conscache.c b/src/or/conscache.c
index 4919dba3d2..33a5495974 100644
--- a/src/or/conscache.c
+++ b/src/or/conscache.c
@@ -539,6 +539,10 @@ consensus_cache_rescan(consensus_cache_t *cache)
map = storage_dir_map_labeled(cache->dir, fname,
&labels, &body, &bodylen);
if (! map) {
+ /* The ERANGE error might come from tor_mmap_file() -- it means the file
+ * was empty. EINVAL might come from ..map_labeled() -- it means the
+ * file was misformatted. In both cases, we should just delete it.
+ */
if (errno == ERANGE || errno == EINVAL) {
log_warn(LD_FS, "Found %s file %s in consensus cache; removing it.",
errno == ERANGE ? "empty" : "misformatted",