Loading changes/bug2077_share_delete 0 → 100644 +7 −0 Original line number Diff line number Diff line o Major bugfixes (windows): - Open files to be mapped with FILE_SHARE_DELETE so that we can replace them before closing the mapping. This is a likely cause of warnings and crashes when replacing the microdescriptor cache file. Diagnosed based on comments by "doorss" and by Robert Ransom. Possible fix for bug 2077; bugfix on 0.2.2.6-alpha. src/common/compat.c +1 −1 Original line number Diff line number Diff line Loading @@ -248,7 +248,7 @@ tor_mmap_file(const char *filename) strlcpy(tfilename,filename,MAX_PATH); #endif file_handle = CreateFile(tfilename, GENERIC_READ, FILE_SHARE_READ, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, Loading src/test/test_microdesc.c +15 −1 Original line number Diff line number Diff line Loading @@ -208,11 +208,25 @@ test_md_cache(void *data) md3 = NULL; /* it's history now! */ /* rebuild again, make sure it stays gone. */ microdesc_cache_rebuild(mc, 1); tt_int_op(microdesc_cache_rebuild(mc, 1), ==, 0); tt_ptr_op(md1, ==, microdesc_cache_lookup_by_digest256(mc, d1)); tt_ptr_op(md2, ==, microdesc_cache_lookup_by_digest256(mc, d2)); tt_ptr_op(NULL, ==, microdesc_cache_lookup_by_digest256(mc, d3)); /* Re-add md3, and make sure we can rebuild the cache. */ added = microdescs_add_to_cache(mc, test_md3_noannotation, NULL, SAVED_NOWHERE, 0, time3, NULL); tt_int_op(1, ==, smartlist_len(added)); md3 = smartlist_get(added, 0); smartlist_free(added); added = NULL; tt_int_op(md1->saved_location, ==, SAVED_IN_CACHE); tt_int_op(md2->saved_location, ==, SAVED_IN_CACHE); tt_int_op(md3->saved_location, ==, SAVED_IN_JOURNAL); tt_int_op(microdesc_cache_rebuild(mc, 1), ==, 0); tt_int_op(md3->saved_location, ==, SAVED_IN_CACHE); done: if (options) tor_free(options->DataDirectory); Loading Loading
changes/bug2077_share_delete 0 → 100644 +7 −0 Original line number Diff line number Diff line o Major bugfixes (windows): - Open files to be mapped with FILE_SHARE_DELETE so that we can replace them before closing the mapping. This is a likely cause of warnings and crashes when replacing the microdescriptor cache file. Diagnosed based on comments by "doorss" and by Robert Ransom. Possible fix for bug 2077; bugfix on 0.2.2.6-alpha.
src/common/compat.c +1 −1 Original line number Diff line number Diff line Loading @@ -248,7 +248,7 @@ tor_mmap_file(const char *filename) strlcpy(tfilename,filename,MAX_PATH); #endif file_handle = CreateFile(tfilename, GENERIC_READ, FILE_SHARE_READ, GENERIC_READ, FILE_SHARE_READ|FILE_SHARE_DELETE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, Loading
src/test/test_microdesc.c +15 −1 Original line number Diff line number Diff line Loading @@ -208,11 +208,25 @@ test_md_cache(void *data) md3 = NULL; /* it's history now! */ /* rebuild again, make sure it stays gone. */ microdesc_cache_rebuild(mc, 1); tt_int_op(microdesc_cache_rebuild(mc, 1), ==, 0); tt_ptr_op(md1, ==, microdesc_cache_lookup_by_digest256(mc, d1)); tt_ptr_op(md2, ==, microdesc_cache_lookup_by_digest256(mc, d2)); tt_ptr_op(NULL, ==, microdesc_cache_lookup_by_digest256(mc, d3)); /* Re-add md3, and make sure we can rebuild the cache. */ added = microdescs_add_to_cache(mc, test_md3_noannotation, NULL, SAVED_NOWHERE, 0, time3, NULL); tt_int_op(1, ==, smartlist_len(added)); md3 = smartlist_get(added, 0); smartlist_free(added); added = NULL; tt_int_op(md1->saved_location, ==, SAVED_IN_CACHE); tt_int_op(md2->saved_location, ==, SAVED_IN_CACHE); tt_int_op(md3->saved_location, ==, SAVED_IN_JOURNAL); tt_int_op(microdesc_cache_rebuild(mc, 1), ==, 0); tt_int_op(md3->saved_location, ==, SAVED_IN_CACHE); done: if (options) tor_free(options->DataDirectory); Loading