[or-cvs] [tor/master] Warn and exit when we are configured to measure GeoIP statistics, but have no GeoIP database.

Nick Mathewson nickm at seul.org
Sat May 30 22:20:29 UTC 2009


Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Sat, 30 May 2009 23:35:21 +0200
Subject: Warn and exit when we are configured to measure GeoIP statistics, but have no GeoIP database.
Commit: dfebc88d56e2c5b470fce20cd7b25914cf2507d4

---
 src/or/config.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/or/config.c b/src/or/config.c
index 0cf0db7..c0f473b 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1378,6 +1378,14 @@ options_act(or_options_t *old_options)
     geoip_load_file(actual_fname, options);
     tor_free(actual_fname);
   }
+#ifdef ENABLE_GEOIP_STATS
+  /* Check if GeoIP database could be loaded. */
+  if (!geoip_is_loaded()) {
+    log_warn(LD_CONFIG, "Configured to measure GeoIP statistics, but no "
+                        "GeoIP database found!");
+    return -1;
+  }
+#endif
   /* Check if we need to parse and add the EntryNodes config option. */
   if (options->EntryNodes &&
       (!old_options ||
-- 
1.5.6.5



More information about the tor-commits mailing list