Merge branch 'ticket32172_once_again'

This commit is contained in:
Nick Mathewson 2019-12-17 15:02:06 -05:00
commit 08bfc2d71a
2 changed files with 15 additions and 0 deletions

4
changes/ticket32172 Normal file
View File

@ -0,0 +1,4 @@
o Minor features (tests, Android):
- When running the unit tests on Android, create temporary files
in a subdirectory of /data/local/tmp. Closes ticket
32172. Based on a patch from Hans-Christoph Steiner.

View File

@ -89,6 +89,17 @@ setup_directory(void)
(int)getpid(), rnd32);
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) */
tor_snprintf(temp_dir, sizeof(temp_dir), "/tmp/tor_test_%d_%s",
(int) getpid(), rnd32);