[or-cvs] Make unit tests run without segfaulting

Nick Mathewson nickm at seul.org
Mon Aug 22 00:34:44 UTC 2005


Update of /home/or/cvsroot/tor/src/or
In directory moria:/tmp/cvs-serv24758/src/or

Modified Files:
	connection_edge.c test.c 
Log Message:
Make unit tests run without segfaulting

Index: connection_edge.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/connection_edge.c,v
retrieving revision 1.341
retrieving revision 1.342
diff -u -d -r1.341 -r1.342
--- connection_edge.c	15 Aug 2005 03:35:15 -0000	1.341
+++ connection_edge.c	22 Aug 2005 00:34:42 -0000	1.342
@@ -871,6 +871,9 @@
    void *_val;
    addressmap_entry_t *val;
 
+   if (!addressmap)
+     addressmap_init();
+
    for (iter = strmap_iter_init(addressmap); !strmap_iter_done(iter); ) {
      strmap_iter_get(iter, &key, &_val);
      val = _val;

Index: test.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/or/test.c,v
retrieving revision 1.191
retrieving revision 1.192
diff -u -d -r1.191 -r1.192
--- test.c	12 Aug 2005 17:24:53 -0000	1.191
+++ test.c	22 Aug 2005 00:34:42 -0000	1.192
@@ -1525,11 +1525,13 @@
 {
   or_options_t *options = options_new();
   network_init();
+  setup_directory();
   options_init(options);
+  options->DataDirectory = tor_strdup(temp_dir);
   set_options(options);
 
   crypto_seed_rng();
-  setup_directory();
+
   rep_hist_init();
   atexit(remove_directory);
 



More information about the tor-commits mailing list