aboutsummaryrefslogtreecommitdiff
path: root/src/app/config/config.c
diff options
context:
space:
mode:
authorHans-Christoph Steiner <hans@eds.org>2021-10-15 10:18:31 +0200
committerHans-Christoph Steiner <hans@eds.org>2021-11-19 14:26:10 +0100
commitccdae2f753ea7125962f65fc50478753e40cc76b (patch)
treedc2983f233a952717a680b3255969a1a092a6d74 /src/app/config/config.c
parent9d8b0c5bdc6f75891440dbe53e2572bf54e74aef (diff)
downloadtor-ccdae2f753ea7125962f65fc50478753e40cc76b.tar.gz
tor-ccdae2f753ea7125962f65fc50478753e40cc76b.zip
On Android, get_data_directory() should not use LOCALSTATEDIR
closes https://gitlab.torproject.org/tpo/core/tor/-/issues/40487
Diffstat (limited to 'src/app/config/config.c')
-rw-r--r--src/app/config/config.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c
index 8df5275cc6..3c3499696b 100644
--- a/src/app/config/config.c
+++ b/src/app/config/config.c
@@ -6883,6 +6883,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)