]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
On Android, get_data_directory() should not use LOCALSTATEDIR
authorHans-Christoph Steiner <hans@eds.org>
Fri, 15 Oct 2021 08:18:31 +0000 (10:18 +0200)
committerHans-Christoph Steiner <hans@eds.org>
Fri, 19 Nov 2021 13:26:10 +0000 (14:26 +0100)
closes https://gitlab.torproject.org/tpo/core/tor/-/issues/40487

src/app/config/config.c

index 8df5275cc6858f19b4725e796652f32e426bb6c3..3c3499696b6b869a87b0b9dff7718a974e798215 100644 (file)
@@ -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)