tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

commit d029a5162d0f2a3255630500f9c81cc4f7bdc103
parent 34083f00aba63f00577bf8612e945affc5409270
Author: Nick Mathewson <nickm@torproject.org>
Date:   Thu, 16 Aug 2018 08:32:06 -0400

Merge branch 'ticket27096'

Diffstat:
Achanges/bug27096 | 3+++
Msrc/test/test_options.c | 22++++++++++++++++++++++
2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/changes/bug27096 b/changes/bug27096 @@ -0,0 +1,3 @@ + o Minor bugfixes (testing): + - Fix two unit tests to work when HOME environment variable is not + set. Fixes bug 27096; bugfix on 0.2.8.1-alpha. diff --git a/src/test/test_options.c b/src/test/test_options.c @@ -473,6 +473,13 @@ test_options_validate__uname_for_server(void *ignored) { (void)ignored; char *msg; + +#ifndef _WIN32 + int unset_home_env = 0; + if (setenv("HOME", "/home/john", 0) == 0) + unset_home_env = 1; +#endif + options_test_data_t *tdata = get_options_test_data( "ORPort 127.0.0.1:5555"); setup_capture_of_logs(LOG_WARN); @@ -512,6 +519,10 @@ test_options_validate__uname_for_server(void *ignored) free_options_test_data(tdata); tor_free(msg); teardown_capture_of_logs(); +#ifndef _WIN32 + if (unset_home_env) + unsetenv("HOME"); +#endif } static void @@ -1413,6 +1424,13 @@ test_options_validate__paths_needed(void *ignored) (void)ignored; int ret; char *msg; + +#ifndef _WIN32 + int unset_home_env = 0; + if (setenv("HOME", "/home/john", 0) == 0) + unset_home_env = 1; +#endif + setup_capture_of_logs(LOG_WARN); options_test_data_t *tdata = get_options_test_data( "PathsNeededToBuildCircuits 0.1\n" @@ -1455,6 +1473,10 @@ test_options_validate__paths_needed(void *ignored) teardown_capture_of_logs(); free_options_test_data(tdata); tor_free(msg); +#ifndef _WIN32 + if (unset_home_env) + unsetenv("HOME"); +#endif } static void