diff options
-rw-r--r-- | changes/bug2930 | 5 | ||||
-rw-r--r-- | src/or/geoip.c | 4 | ||||
-rw-r--r-- | src/or/rephist.c | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/changes/bug2930 b/changes/bug2930 new file mode 100644 index 000000000..8d28664d3 --- /dev/null +++ b/changes/bug2930 @@ -0,0 +1,5 @@ + o Minor features: + - Replace files in stats/ rather than appending to them. Now that we + include statistics in extra-info descriptors, it makes no sense to + keep old statistics forever. Implements #2930. + diff --git a/src/or/geoip.c b/src/or/geoip.c index 5596ff325..d02666bf9 100644 --- a/src/or/geoip.c +++ b/src/or/geoip.c @@ -996,7 +996,7 @@ geoip_dirreq_stats_write(time_t now) data_v2 = geoip_get_client_history(GEOIP_CLIENT_NETWORKSTATUS_V2); data_v3 = geoip_get_client_history(GEOIP_CLIENT_NETWORKSTATUS); format_iso_time(written, now); - out = start_writing_to_stdio_file(filename, OPEN_FLAGS_APPEND | O_TEXT, + out = start_writing_to_stdio_file(filename, OPEN_FLAGS_REPLACE | O_TEXT, 0600, &open_file); if (!out) goto done; @@ -1329,7 +1329,7 @@ geoip_entry_stats_write(time_t now) filename = get_datadir_fname2("stats", "entry-stats"); data = geoip_get_client_history(GEOIP_CLIENT_CONNECT); format_iso_time(written, now); - out = start_writing_to_stdio_file(filename, OPEN_FLAGS_APPEND | O_TEXT, + out = start_writing_to_stdio_file(filename, OPEN_FLAGS_REPLACE | O_TEXT, 0600, &open_file); if (!out) goto done; diff --git a/src/or/rephist.c b/src/or/rephist.c index 1ad08fe93..672e3f3da 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -2490,7 +2490,7 @@ rep_hist_buffer_stats_write(time_t now) if (check_private_dir(statsdir, CPD_CREATE, get_options()->User) < 0) goto done; filename = get_datadir_fname2("stats", "buffer-stats"); - out = start_writing_to_stdio_file(filename, OPEN_FLAGS_APPEND | O_TEXT, + out = start_writing_to_stdio_file(filename, OPEN_FLAGS_REPLACE | O_TEXT, 0600, &open_file); if (!out) goto done; |