aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Hahn <sebastian@torproject.org>2011-04-26 02:20:29 +0200
committerNick Mathewson <nickm@torproject.org>2011-05-09 13:19:44 -0400
commit58a16a4d6f47728e029cc8380604bda262a40d30 (patch)
tree1c0ad139305d01738753f6ece07eda9d981eea5b
parent532c13693e97565fe50a8a788d669d3ec94ad822 (diff)
downloadtor-58a16a4d6f47728e029cc8380604bda262a40d30.tar
tor-58a16a4d6f47728e029cc8380604bda262a40d30.tar.gz
Add an assert to un-confuse clang's analyzer
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.
-rw-r--r--src/or/control.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/or/control.c b/src/or/control.c
index 28780d298..926a46520 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -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. */