diff options
author | Gisle Vanem <gvanem@broadpark.no> | 2011-04-07 18:34:11 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-04-07 18:34:11 -0400 |
commit | 70e02914682eb1959d8b385f76b5acf7486158cc (patch) | |
tree | 79995486839ce9f1d94eb9584d730fbef7de1d26 /src/test/test.c | |
parent | ba0cd8094f8e6ae0113ad69958d9d0973bb1f2c3 (diff) | |
download | tor-70e02914682eb1959d8b385f76b5acf7486158cc.tar.gz tor-70e02914682eb1959d8b385f76b5acf7486158cc.zip |
Use GetTempDir instead of hardcoded path to c:\windows\tmp for unittests
Diffstat (limited to 'src/test/test.c')
-rw-r--r-- | src/test/test.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/test/test.c b/src/test/test.c index f5b6a222a7..9b24a99b58 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); |