mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
set up tmp dir for test suite to run on Android
There is no /tmp or mkdtemp on Android, there is /data/local/tmp for root and the shell user. So this fakes mkdtemp. Also, FYI, tor might not like the default perms of /data/local/tmp, e.g. 0770. https://trac.torproject.org/projects/tor/ticket/32172
This commit is contained in:
parent
944bdde50e
commit
4d4cbf739f
@ -89,6 +89,17 @@ setup_directory(void)
|
|||||||
(int)getpid(), rnd32);
|
(int)getpid(), rnd32);
|
||||||
r = mkdir(temp_dir);
|
r = mkdir(temp_dir);
|
||||||
}
|
}
|
||||||
|
#elif defined(__ANDROID__)
|
||||||
|
/* tor might not like the default perms, so create a subdir */
|
||||||
|
tor_snprintf(temp_dir, sizeof(temp_dir),
|
||||||
|
"/data/local/tmp/tor_%d_%d_%s",
|
||||||
|
(int) getuid(), (int) getpid(), rnd32);
|
||||||
|
r = mkdir(temp_dir, 0700);
|
||||||
|
if (r) {
|
||||||
|
fprintf(stderr, "Can't create directory %s:", temp_dir);
|
||||||
|
perror("");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
#else /* !defined(_WIN32) */
|
#else /* !defined(_WIN32) */
|
||||||
tor_snprintf(temp_dir, sizeof(temp_dir), "/tmp/tor_test_%d_%s",
|
tor_snprintf(temp_dir, sizeof(temp_dir), "/tmp/tor_test_%d_%s",
|
||||||
(int) getpid(), rnd32);
|
(int) getpid(), rnd32);
|
||||||
|
Loading…
Reference in New Issue
Block a user