diff options
author | David Goulet <dgoulet@torproject.org> | 2023-09-18 13:12:36 +0000 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2023-09-18 13:12:36 +0000 |
commit | 7278c1554da9fb31dbb81b5f22f49a9a475db3ce (patch) | |
tree | b5d75fe2ee8c20e5131c423d78137b4b6104413b | |
parent | 8425e1e575bfd57670b65a9b944da9dcbe2365a0 (diff) | |
parent | a8b573a322542f882cd2d51fad12847d458c3480 (diff) | |
download | tor-7278c1554da9fb31dbb81b5f22f49a9a475db3ce.tar.gz tor-7278c1554da9fb31dbb81b5f22f49a9a475db3ce.zip |
Merge branch 'ahf/android-gp-fixes-bulk' into 'main'
Bulk Android path changes
Closes #40487
See merge request tpo/core/tor!762
-rw-r--r-- | changes/ticket40487 | 3 | ||||
-rw-r--r-- | src/app/config/config.c | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/changes/ticket40487 b/changes/ticket40487 new file mode 100644 index 0000000000..bd64d475b8 --- /dev/null +++ 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 index ae7f6203ce..102d1bbc04 100644 --- 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) |