mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
First part of making mmap-based stuff work on win32: save descriptors as "binary" (no LF->CRLF tanslation) so that we can mmap them properly later. Patch from Frediano Ziglio.
svn:r6748
This commit is contained in:
parent
51454157a0
commit
a7a1d4e3d3
@ -181,7 +181,7 @@ router_append_to_journal(signed_descriptor_t *desc)
|
|||||||
|
|
||||||
tor_assert(len == strlen(body));
|
tor_assert(len == strlen(body));
|
||||||
|
|
||||||
if (append_bytes_to_file(fname, body, len, 0)) {
|
if (append_bytes_to_file(fname, body, len, 1)) {
|
||||||
log_warn(LD_FS, "Unable to store router descriptor");
|
log_warn(LD_FS, "Unable to store router descriptor");
|
||||||
tor_free(fname);
|
tor_free(fname);
|
||||||
return -1;
|
return -1;
|
||||||
@ -271,7 +271,7 @@ router_rebuild_store(int force)
|
|||||||
smartlist_add(chunk_list, c);
|
smartlist_add(chunk_list, c);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (write_chunks_to_file(fname, chunk_list, 0)<0) {
|
if (write_chunks_to_file(fname, chunk_list, 1)<0) {
|
||||||
log_warn(LD_FS, "Error writing router store to disk.");
|
log_warn(LD_FS, "Error writing router store to disk.");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
@ -308,7 +308,7 @@ router_rebuild_store(int force)
|
|||||||
tor_snprintf(fname, fname_len, "%s/cached-routers.new",
|
tor_snprintf(fname, fname_len, "%s/cached-routers.new",
|
||||||
options->DataDirectory);
|
options->DataDirectory);
|
||||||
|
|
||||||
write_str_to_file(fname, "", 0);
|
write_str_to_file(fname, "", 1);
|
||||||
|
|
||||||
r = 0;
|
r = 0;
|
||||||
router_store_len = len;
|
router_store_len = len;
|
||||||
@ -350,7 +350,7 @@ router_reload_router_list(void)
|
|||||||
|
|
||||||
tor_snprintf(fname, fname_len, "%s/cached-routers.new",
|
tor_snprintf(fname, fname_len, "%s/cached-routers.new",
|
||||||
options->DataDirectory);
|
options->DataDirectory);
|
||||||
contents = read_file_to_str(fname, 0);
|
contents = read_file_to_str(fname, 1);
|
||||||
if (contents) {
|
if (contents) {
|
||||||
stat(fname, &st);
|
stat(fname, &st);
|
||||||
router_load_routers_from_string(contents,
|
router_load_routers_from_string(contents,
|
||||||
|
Loading…
Reference in New Issue
Block a user