summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-05-29 01:22:30 +0000
committerNick Mathewson <nickm@torproject.org>2008-05-29 01:22:30 +0000
commita335b94c8fd87c65778320f276091e52d83c8609 (patch)
treea22b506d0b254da3c8cbab57a8473212f8099851 /src
parent4ead083dbc7c742356b77f3e18de615eb2b6999b (diff)
downloadtor-a335b94c8fd87c65778320f276091e52d83c8609.tar.gz
tor-a335b94c8fd87c65778320f276091e52d83c8609.zip
On win32, default to looking for the geoip file in the same directory as torrc. This is a dumb hack; it should turn into a general mechanism.
svn:r14796
Diffstat (limited to 'src')
-rw-r--r--src/or/config.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 74c500d345..8b45e8ca2e 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -199,7 +199,12 @@ static config_var_t _option_vars[] = {
V(FetchHidServDescriptors, BOOL, "1"),
V(FetchUselessDescriptors, BOOL, "0"),
V(GeoIPFile, STRING,
- SHARE_DATADIR PATH_SEPARATOR "tor" PATH_SEPARATOR "geoip"),
+#ifdef WIN32
+ "<default>"
+#else
+ SHARE_DATADIR PATH_SEPARATOR "tor" PATH_SEPARATOR "geoip"
+#endif
+),
V(Group, STRING, NULL),
V(HardwareAccel, BOOL, "0"),
V(HashedControlPassword, LINELIST, NULL),
@@ -1259,7 +1264,20 @@ options_act(or_options_t *old_options)
if (options->GeoIPFile &&
((!old_options || !opt_streq(old_options->GeoIPFile, options->GeoIPFile))
|| !geoip_is_loaded())) {
- geoip_load_file(options->GeoIPFile);
+ /* XXXX021 Don't use this "<default>" junk; make our filename options
+ * understand prefixes somehow. -NM */
+ char *actual_fname = tor_strdup(options->GeoIPFile);
+#ifdef WIN32
+ if (!strcmp(actual_fname, "<default>")) {
+ const char *conf_root = get_windows_conf_root();
+ size_t len = tor_malloc(strlen(conf_root)+16);
+ tor_free(actual_fname);
+ actual_fname = tor_malloc(len+1);
+ tor_snprintf(actual_fname, len, "%s\\geoip", conf_root);
+ }
+#endif
+ geoip_load_file(actual_fname);
+ tor_free(actual_fname);
}
/* Check if we need to parse and add the EntryNodes config option. */
if (options->EntryNodes &&