summaryrefslogtreecommitdiff
path: root/src/test/test.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-04-07 20:27:39 -0400
committerNick Mathewson <nickm@torproject.org>2011-04-07 20:27:39 -0400
commit85ac832a1474e274ff4a6ad9444cf5e0ab12450e (patch)
tree91cdfc6019b3b5fc63b75ee7f8af365659ce05db /src/test/test.c
parent67d88a7d6021e95a2d423a9f26811accd1da39b6 (diff)
parent70e02914682eb1959d8b385f76b5acf7486158cc (diff)
downloadtor-85ac832a1474e274ff4a6ad9444cf5e0ab12450e.tar.gz
tor-85ac832a1474e274ff4a6ad9444cf5e0ab12450e.zip
Merge remote-tracking branch 'origin/maint-0.2.2'
Diffstat (limited to 'src/test/test.c')
-rw-r--r--src/test/test.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/test/test.c b/src/test/test.c
index 02e3970557..e2f8b115d3 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -84,10 +84,16 @@ setup_directory(void)
if (is_setup) return;
#ifdef MS_WINDOWS
- // XXXX
- tor_snprintf(temp_dir, sizeof(temp_dir),
- "c:\\windows\\temp\\tor_test_%d", (int)getpid());
- r = mkdir(temp_dir);
+ {
+ char buf[MAX_PATH];
+ const char *tmp = buf;
+ /* If this fails, we're probably screwed anyway */
+ if (!GetTempPath(sizeof(buf),buf))
+ tmp = "c:\\windows\\temp";
+ tor_snprintf(temp_dir, sizeof(temp_dir),
+ "%s\\tor_test_%d", tmp, (int)getpid());
+ r = mkdir(temp_dir);
+ }
#else
tor_snprintf(temp_dir, sizeof(temp_dir), "/tmp/tor_test_%d", (int) getpid());
r = mkdir(temp_dir, 0700);