commit 7278c1554da9fb31dbb81b5f22f49a9a475db3ce
parent 8425e1e575bfd57670b65a9b944da9dcbe2365a0
Author: David Goulet <dgoulet@torproject.org>
Date: Mon, 18 Sep 2023 13:12:36 +0000
Merge branch 'ahf/android-gp-fixes-bulk' into 'main'
Bulk Android path changes
Closes #40487
See merge request tpo/core/tor!762
Diffstat:
2 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/changes/ticket40487 b/changes/ticket40487
@@ -0,0 +1,3 @@
+ o Minor features (portability, android):
+ - Use /data/local/tmp for data storage on Android by default. Closes ticket
+ 40487. Patch from Hans-Christoph Steiner.
diff --git a/src/app/config/config.c b/src/app/config/config.c
@@ -483,6 +483,13 @@ static const config_var_t option_vars_[] = {
#ifdef _WIN32
V(GeoIPFile, FILENAME, "<default>"),
V(GeoIPv6File, FILENAME, "<default>"),
+#elif defined(__ANDROID__)
+ /* Android apps use paths that are configured at runtime.
+ * /data/local/tmp is guaranteed to exist, but will only be
+ * usable by the 'shell' and 'root' users, so this fallback is
+ * for debugging only. */
+ V(GeoIPFile, FILENAME, "/data/local/tmp/geoip"),
+ V(GeoIPv6File, FILENAME, "/data/local/tmp/geoip6"),
#else
V(GeoIPFile, FILENAME,
SHARE_DATADIR PATH_SEPARATOR "tor" PATH_SEPARATOR "geoip"),
@@ -6900,6 +6907,15 @@ get_data_directory(const char *val)
} else {
return tor_strdup(get_windows_conf_root());
}
+#elif defined(__ANDROID__)
+ /* Android apps can only use paths that are configured at runtime.
+ * /data/local/tmp is guaranteed to exist, but is only usable by the
+ * 'shell' and 'root' users, so this fallback is for debugging only. */
+ if (val) {
+ return tor_strdup(val);
+ } else {
+ return tor_strdup("/data/local/tmp");
+ }
#else /* !defined(_WIN32) */
const char *d = val;
if (!d)