From 7585c8e0b38180bfb016e82063085a00adcb1e68 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Fri, 23 Aug 2013 15:00:50 +0200 Subject: pingu_conf: improve error checking for load-balance --- src/pingu_conf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pingu_conf.c b/src/pingu_conf.c index 6470809..292d220 100644 --- a/src/pingu_conf.c +++ b/src/pingu_conf.c @@ -173,12 +173,14 @@ static int pingu_conf_read_iface(struct pingu_conf *conf, char *ifname) } else if (strcmp(key, "load-balance") == 0) { int weight = 0; if (value != NULL) { - weight = atoi(value); - if (weight <= 0 || weight > 256) { + int err; + err = parse_int(value, &weight, conf->lineno); + if (!err && (weight <= 0 || weight > 256)) { log_error("Invalid load-balance weight %i on line %i", weight, conf->lineno); - return -1; + r++; } + r += err; } pingu_iface_set_balance(iface, weight); } else if (strcmp(key, "ping") == 0) { -- cgit v1.2.3