]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Unmap microdesc cache before replacing it.
authorNick Mathewson <nickm@torproject.org>
Thu, 12 May 2011 15:19:52 +0000 (11:19 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 12 May 2011 15:19:52 +0000 (11:19 -0400)
If we do a replace-then-munmap, windows will never actually rewrite
the microdesc cache.

Found by wanoskarnet; bugfix on 0.2.2.6-alpha.

changes/md_cache_replace [new file with mode: 0644]
src/or/microdesc.c

diff --git a/changes/md_cache_replace b/changes/md_cache_replace
new file mode 100644 (file)
index 0000000..88e029c
--- /dev/null
@@ -0,0 +1,6 @@
+  o Minor bugfixes
+    - Avoid a bug that would keep us from replacing a microdescriptor
+      cache on Windows.  (We would try to replace the file while still
+      holding it open.  That's fine on Unix, but Windows doesn't let us
+      do that.)  Bugfix on 0.2.2.6-alpha; bug found by wanoskarnet.
+
index 5740c40d5f959e583d4100b94eecb89f34732d07..1554aca9183a8e2704bad1aa0ae20305d531b5c1 100644 (file)
@@ -399,10 +399,11 @@ microdesc_cache_rebuild(microdesc_cache_t *cache, int force)
     smartlist_add(wrote, md);
   }
 
-  finish_writing_to_file(open_file); /*XXX Check me.*/
-
   if (cache->cache_content)
     tor_munmap_file(cache->cache_content);
+
+  finish_writing_to_file(open_file); /*XXX Check me.*/
+
   cache->cache_content = tor_mmap_file(cache->cache_fname);
 
   if (!cache->cache_content && smartlist_len(wrote)) {