[tor-dev] [Patch] src/test.c

Nick Mathewson nickm at freehaven.net
Thu Apr 7 21:10:05 UTC 2011


On Thu, Apr 7, 2011 at 3:48 PM, Gisle Vanem <gvanem at broadpark.no> wrote:
> I don't think it's a good idea to use hard-coded paths. Even in a
> test source-file. Easy patch:
>
> --- Git-latest\src\test\test.c       Wed Mar 30 11:58:28 2011
> +++ src\test\test.c  Thu Mar 31 14:06:14 2011
> @@ -86,7 +86,7 @@
> #ifdef MS_WINDOWS
>  // XXXX
>  tor_snprintf(temp_dir, sizeof(temp_dir),
> -               "c:\\windows\\temp\\tor_test_%d", (int)getpid());
> +               "%s\\tor_test_%d", getenv("TEMP"), (int)getpid());
>  r = mkdir(temp_dir);
> #else
>  tor_snprintf(temp_dir, sizeof(temp_dir), "/tmp/tor_test_%d", (int)
> getpid());

What guarantees that TEMP will always be defined?


More information about the tor-dev mailing list