[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] [tor/master] when loading bridge stats, mkdir $datadir/stats first



Author: Roger Dingledine <arma@xxxxxxxxxxxxxx>
Date: Sat, 2 Jan 2010 09:28:19 -0500
Subject: when loading bridge stats, mkdir $datadir/stats first
Commit: 485fa5c425e971cbd20de2b7e6e7447b5acf7f7c

---
 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 45dc8cf..b0f97d4 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
-- 
1.5.6.5