[tor-dev] [Patch] test/test.c. TEMP-dir

Gisle Vanem gvanem at yahoo.no
Thu Jun 5 11:06:13 UTC 2014


Hello list.

I don't get any FAILED tests running on Win32 (MSVC), but IMHO the use
of '\\' in the TEMP-directory doesn't look quite kosher (looks a bit like a
"\\server\share\path" UNC-syntax).

>From test_crypto_pk() running 'test.exe --warn':

  Jun 05 10:13:05.046 [warn] Could not open "F:\TEMP\\tor_test_3992_vv7drny6/xyzzy": No such file or directory
  Jun 05 10:13:05.046 [warn] Error reading private key from "F:\TEMP\\tor_test_3992_vv7drny6/xyzzy"

So can you accept this small change:

diff --git a/src/test/test.c b/src/test/test.c
index 8bce9c9..98620e5 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -108,9 +108,9 @@ setup_directory(void)
     const char *tmp = buf;
     /* If this fails, we're probably screwed anyway */
     if (!GetTempPathA(sizeof(buf),buf))
-      tmp = "c:\\windows\\temp";
+      tmp = "c:\\windows\\temp\\";
     tor_snprintf(temp_dir, sizeof(temp_dir),
-                 "%s\\tor_test_%d_%s", tmp, (int)getpid(), rnd32);
+                 "%stor_test_%d_%s", tmp, (int)getpid(), rnd32);
     r = mkdir(temp_dir);
   }
 #else

------------------

Ref:
  http://msdn.microsoft.com/en-us/library/windows/desktop/aa364992(v=vs.85).aspx

  lpBuffer [out]
  A pointer to a string buffer that receives the null-terminated string specifying the
  temporary file path. The returned string ends with a backslash, for example,
  "C:\TEMP\".

----------

I also tested 'test.exe --warn' without any TMP or TEMP. Thus my USERPROFILE is
used:
  Jun 05 10:46:47.984 [warn] Could not open "f:\Documents and Settings\Gisle Vanem\tor_test_6368_s62ks2fe/xyzzy": No such file or 
directory
  Jun 05 10:46:47.984 [warn] Error reading private key from "f:\Documents and Settings\Gisle Vanem\tor_test_6368_s62ks2fe/xyzzy"

--gv




More information about the tor-dev mailing list