aboutsummaryrefslogtreecommitdiff
path: root/src/lib/confmgt
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-06-19 08:15:13 -0400
committerNick Mathewson <nickm@torproject.org>2019-06-24 17:50:43 -0400
commit705bda859ed8bbdd753d587b9814de4af3afee80 (patch)
treef43a0c7c1224659bfbaf67f92ca823caf24c4028 /src/lib/confmgt
parentf0074372928829835adf6aa2dde9af712097c7c0 (diff)
downloadtor-705bda859ed8bbdd753d587b9814de4af3afee80.tar.gz
tor-705bda859ed8bbdd753d587b9814de4af3afee80.zip
Add unit tests for the unitparse.c module.
Diffstat (limited to 'src/lib/confmgt')
-rw-r--r--src/lib/confmgt/unitparse.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/confmgt/unitparse.c b/src/lib/confmgt/unitparse.c
index 906195259d..c3ed8285a4 100644
--- a/src/lib/confmgt/unitparse.c
+++ b/src/lib/confmgt/unitparse.c
@@ -128,10 +128,14 @@ config_parse_units(const char *val, const unit_table_t *u, int *ok)
use_float = 1;
}
- if (!cp) {
+ if (BUG(!cp)) {
+ // cp should always be non-NULL if the parse operation succeeds.
+
+ // LCOV_EXCL_START
*ok = 1;
v = use_float ? ((uint64_t)d) : v;
goto done;
+ // LCOV_EXCL_STOP
}
cp = (char*) eat_whitespace(cp);