[tor-commits] [tor/master] Check return value of crypto_global_init in test.c

nickm at torproject.org nickm at torproject.org
Fri Jul 1 16:57:14 UTC 2011


commit 0317dc2bb2223dd8a51fc8b54a69765764d094d3
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Jul 1 11:56:09 2011 -0400

    Check return value of crypto_global_init in test.c
    
    This will let the unit tests fail in a less mystifying way if the
    crypto subsystem is b0rken, and will also make Coverity happier.
    
    CID # 429.
---
 src/test/test.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/test/test.c b/src/test/test.c
index 1db1546..02d238e 100644
--- a/src/test/test.c
+++ b/src/test/test.c
@@ -1318,7 +1318,10 @@ main(int c, const char **v)
   }
 
   options->command = CMD_RUN_UNITTESTS;
-  crypto_global_init(0, NULL, NULL);
+  if (crypto_global_init(0, NULL, NULL)) {
+    printf("Can't initialize crypto subsystem; exiting.\n");
+    return 1;
+  }
   rep_hist_init();
   network_init();
   setup_directory();





More information about the tor-commits mailing list