test_config_check_or_create_data_subdir(void *arg)
{
or_options_t *options = get_options_mutable();
- char *datadir = options->DataDirectory = tor_strdup(get_fname("datadir-0"));
+ char *datadir;
const char *subdir = "test_stats";
- char *subpath = get_datadir_fname(subdir);
+ char *subpath;
struct stat st;
int r;
#if !defined (_WIN32) || defined (WINCE)
#endif
(void)arg;
+ tor_free(options->DataDirectory);
+ datadir = options->DataDirectory = tor_strdup(get_fname("datadir-0"));
+ subpath = get_datadir_fname(subdir);
+
#if defined (_WIN32) && !defined (WINCE)
tt_int_op(mkdir(options->DataDirectory), ==, 0);
#else
test_config_write_to_data_subdir(void *arg)
{
or_options_t* options = get_options_mutable();
- char *datadir = options->DataDirectory = tor_strdup(get_fname("datadir-1"));
+ char *datadir;
char *cp = NULL;
const char* subdir = "test_stats";
const char* fname = "test_file";
char* filepath = get_datadir_fname2(subdir, fname);
(void)arg;
+ tor_free(options->DataDirectory);
+ datadir = options->DataDirectory = tor_strdup(get_fname("datadir-1"));
+
#if defined (_WIN32) && !defined (WINCE)
tt_int_op(mkdir(options->DataDirectory), ==, 0);
#else
(void)arg;
/* Check default filename location */
+ tor_free(options->DataDirectory);
options->DataDirectory = tor_strdup("foo");
cp = get_ext_or_auth_cookie_file_name();
tt_str_op(cp, ==, "foo"PATH_SEPARATOR"extended_orport_auth_cookie");
tt_assert(key);
options->ORPort_set = 1; /* So that we can get the server ID key */
+ tor_free(options->DataDirectory);
options->DataDirectory = tor_strdup(ddir);
options->Nickname = tor_strdup("haflinger");
set_server_identity_key(key);