]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
add an explanatory comment about the error codes
authorNick Mathewson <nickm@torproject.org>
Tue, 21 Nov 2017 17:36:32 +0000 (12:36 -0500)
committerNick Mathewson <nickm@torproject.org>
Tue, 21 Nov 2017 17:36:32 +0000 (12:36 -0500)
src/or/conscache.c

index 4919dba3d2286688b92614358302d02f7045a53e..33a5495974b43e001ece688f0f9bdcb67a8e8df9 100644 (file)
@@ -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",