Merge remote-tracking branch 'origin/maint-0.2.2'

This commit is contained in:
Nick Mathewson 2011-07-19 12:59:10 -04:00
commit c2d3da6303
5 changed files with 24 additions and 7 deletions

15
changes/bug3607 Normal file
View file

@ -0,0 +1,15 @@
o Minor bugfixes:
- Write several files in text mode, on OSes that distinguish text
mode from binary mode (namely, Windows). These files are:
buffer-stats, dirreq-stats, and entry-stats on relays that collect
those statistics; client_keys and hostname files for hidden
services that use authentication; and (in the tor-gencert utility)
newly generated identity and signing keys. Previously, we
wouldn't specify text mode or binary mode, leading to an assertion
failure. Fixes bug 3607. Bugfix on 0.2.1.1-alpha (when the
DirRecordUsageByCountry option which would have triggered the
assertion failure was added), although this assertion failure
would have occurred in tor-gencert on Windows in 0.2.0.1-alpha.

View file

@ -996,7 +996,7 @@ geoip_dirreq_stats_write(time_t now)
data_v2 = geoip_get_client_history(GEOIP_CLIENT_NETWORKSTATUS_V2); data_v2 = geoip_get_client_history(GEOIP_CLIENT_NETWORKSTATUS_V2);
data_v3 = geoip_get_client_history(GEOIP_CLIENT_NETWORKSTATUS); data_v3 = geoip_get_client_history(GEOIP_CLIENT_NETWORKSTATUS);
format_iso_time(written, now); format_iso_time(written, now);
out = start_writing_to_stdio_file(filename, OPEN_FLAGS_APPEND, out = start_writing_to_stdio_file(filename, OPEN_FLAGS_APPEND | O_TEXT,
0600, &open_file); 0600, &open_file);
if (!out) if (!out)
goto done; goto done;
@ -1329,7 +1329,7 @@ geoip_entry_stats_write(time_t now)
filename = get_datadir_fname2("stats", "entry-stats"); filename = get_datadir_fname2("stats", "entry-stats");
data = geoip_get_client_history(GEOIP_CLIENT_CONNECT); data = geoip_get_client_history(GEOIP_CLIENT_CONNECT);
format_iso_time(written, now); format_iso_time(written, now);
out = start_writing_to_stdio_file(filename, OPEN_FLAGS_APPEND, out = start_writing_to_stdio_file(filename, OPEN_FLAGS_APPEND | O_TEXT,
0600, &open_file); 0600, &open_file);
if (!out) if (!out)
goto done; goto done;

View file

@ -636,13 +636,15 @@ rend_service_load_keys(void)
} }
/* Prepare client_keys and hostname files. */ /* Prepare client_keys and hostname files. */
if (!(cfile = start_writing_to_stdio_file(cfname, OPEN_FLAGS_REPLACE, if (!(cfile = start_writing_to_stdio_file(cfname,
OPEN_FLAGS_REPLACE | O_TEXT,
0600, &open_cfile))) { 0600, &open_cfile))) {
log_warn(LD_CONFIG, "Could not open client_keys file %s", log_warn(LD_CONFIG, "Could not open client_keys file %s",
escaped(cfname)); escaped(cfname));
goto err; goto err;
} }
if (!(hfile = start_writing_to_stdio_file(fname, OPEN_FLAGS_REPLACE, if (!(hfile = start_writing_to_stdio_file(fname,
OPEN_FLAGS_REPLACE | O_TEXT,
0600, &open_hfile))) { 0600, &open_hfile))) {
log_warn(LD_CONFIG, "Could not open hostname file %s", escaped(fname)); log_warn(LD_CONFIG, "Could not open hostname file %s", escaped(fname));
goto err; goto err;

View file

@ -2490,7 +2490,7 @@ rep_hist_buffer_stats_write(time_t now)
if (check_private_dir(statsdir, CPD_CREATE, get_options()->User) < 0) if (check_private_dir(statsdir, CPD_CREATE, get_options()->User) < 0)
goto done; goto done;
filename = get_datadir_fname2("stats", "buffer-stats"); filename = get_datadir_fname2("stats", "buffer-stats");
out = start_writing_to_stdio_file(filename, OPEN_FLAGS_APPEND, out = start_writing_to_stdio_file(filename, OPEN_FLAGS_APPEND | O_TEXT,
0600, &open_file); 0600, &open_file);
if (!out) if (!out)
goto done; goto done;

View file

@ -264,7 +264,7 @@ load_identity_key(void)
} }
if (!(f = start_writing_to_stdio_file(identity_key_file, if (!(f = start_writing_to_stdio_file(identity_key_file,
OPEN_FLAGS_REPLACE, 0400, OPEN_FLAGS_REPLACE | O_TEXT, 0400,
&open_file))) &open_file)))
return 1; return 1;
@ -349,7 +349,7 @@ generate_signing_key(void)
} }
if (!(f = start_writing_to_stdio_file(signing_key_file, if (!(f = start_writing_to_stdio_file(signing_key_file,
OPEN_FLAGS_REPLACE, 0600, OPEN_FLAGS_REPLACE | O_TEXT, 0600,
&open_file))) &open_file)))
return 1; return 1;