From: William Lallemand Date: Wed, 7 Nov 2012 12:21:47 +0000 (+0100) Subject: MINOR: compression: try init in cfgparse.c X-Git-Tag: v1.5-dev13~76 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=552df67100edc65433aaec984f69620633b5b7c5;p=thirdparty%2Fhaproxy.git MINOR: compression: try init in cfgparse.c Try to init and deinit the algorithm in the configuration parser and exit with error if it doesn't work. --- diff --git a/src/cfgparse.c b/src/cfgparse.c index 2b451225dc..4a1ca758ac 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -5296,6 +5296,8 @@ stats_error_parsing: if (!strcmp(args[1], "algo")) { int cur_arg; + struct comp_ctx ctx; + cur_arg = 2; if (!*args[cur_arg]) { Alert("parsing [%s:%d] : '%s' expects \n", @@ -5310,6 +5312,14 @@ stats_error_parsing: err_code |= ERR_ALERT | ERR_FATAL; goto out; } + if (curproxy->comp->algos->init(&ctx, 9) == 0) { + curproxy->comp->algos->end(&ctx); + } else { + Alert("parsing [%s:%d] : '%s' : Can't init '%s' algorithm.\n", + file, linenum, args[0], args[cur_arg]); + err_code |= ERR_ALERT | ERR_FATAL; + goto out; + } cur_arg ++; continue; }