]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Add an assert to un-confuse clang's analyzer
authorSebastian Hahn <sebastian@torproject.org>
Tue, 26 Apr 2011 00:20:29 +0000 (02:20 +0200)
committerNick Mathewson <nickm@torproject.org>
Mon, 9 May 2011 17:19:44 +0000 (13:19 -0400)
The analyzer assumed that bootstrap_percent could be less than 0 when we
call control_event_bootstrap_problem(), which would mean we're calling
log_fn() with undefined values. The assert makes it clear this can't
happen.

src/or/control.c

index 28780d298936bcffabf0fa6d48d3a1eda1d5a63e..926a4652033949c19d3b2f6968718b13838cc2cd 100644 (file)
@@ -3931,6 +3931,9 @@ control_event_bootstrap_problem(const char *warn, int reason)
   char buf[BOOTSTRAP_MSG_LEN];
   const char *recommendation = "ignore";
 
+  /* bootstrap_percent must not be in "undefined" state here. */
+  tor_assert(status >= 0);
+
   if (bootstrap_percent == 100)
     return; /* already bootstrapped; nothing to be done here. */