[or-cvs] r14797: Backport: On win32, default to looking for the geoip file in (tor/branches/tor-0_2_0-patches/src/or)
nickm at seul.org
nickm at seul.org
Thu May 29 01:23:10 UTC 2008
Author: nickm
Date: 2008-05-28 21:23:09 -0400 (Wed, 28 May 2008)
New Revision: 14797
Modified:
tor/branches/tor-0_2_0-patches/src/or/config.c
Log:
Backport: On win32, default to looking for the geoip file in the same directory as torrc.
Modified: tor/branches/tor-0_2_0-patches/src/or/config.c
===================================================================
--- tor/branches/tor-0_2_0-patches/src/or/config.c 2008-05-29 01:22:30 UTC (rev 14796)
+++ tor/branches/tor-0_2_0-patches/src/or/config.c 2008-05-29 01:23:09 UTC (rev 14797)
@@ -199,7 +199,12 @@
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),
@@ -1252,7 +1257,20 @@
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 &&
More information about the tor-commits
mailing list