diff options
author | Roger Dingledine <arma@torproject.org> | 2010-01-02 09:28:19 -0500 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2010-01-02 09:28:19 -0500 |
commit | 485fa5c425e971cbd20de2b7e6e7447b5acf7f7c (patch) | |
tree | 7bec44eaaaa761042138ffa6557e0e5788bf966b /src | |
parent | 4d71d437726692ee65bdb7c2968a65de6ba3f786 (diff) | |
download | tor-485fa5c425e971cbd20de2b7e6e7447b5acf7f7c.tar.gz tor-485fa5c425e971cbd20de2b7e6e7447b5acf7f7c.zip |
when loading bridge stats, mkdir $datadir/stats first
Diffstat (limited to 'src')
-rw-r--r-- | src/or/geoip.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/or/geoip.c b/src/or/geoip.c index 45dc8cf344..b0f97d4ff3 100644 --- a/src/or/geoip.c +++ b/src/or/geoip.c @@ -1230,9 +1230,12 @@ geoip_bridge_stats_write(time_t now) static void load_bridge_stats(time_t now) { - char *fname, *contents, *controller_str; + char *statsdir, *fname=NULL, *contents, *controller_str; if (bridge_stats_extrainfo) return; + statsdir = get_datadir_fname("stats"); + if (check_private_dir(statsdir, CPD_CREATE) < 0) + goto done; fname = get_datadir_fname2("stats", "bridge-stats"); contents = read_file_to_str(fname, 0, NULL); if (contents) { @@ -1244,7 +1247,9 @@ load_bridge_stats(time_t now) tor_free(contents); } } + done: tor_free(fname); + tor_free(statsdir); } /** Return most recent bridge statistics for inclusion in extra-info |