kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit d1c8f95590e9d872451731a309b92c924e344044
parent 03b927dd64b44b4027afda799460288353062f15
Author: Joris Vink <joris@coders.se>
Date:   Fri, 10 Aug 2018 08:06:09 +0200

Show the reason why regcomp() failed if it does.

Diffstat:
src/validator.c | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/validator.c b/src/validator.c @@ -27,6 +27,7 @@ kore_validator_init(void) int kore_validator_add(const char *name, u_int8_t type, const char *arg) { + int ret; struct kore_validator *val; val = kore_malloc(sizeof(*val)); @@ -34,10 +35,12 @@ kore_validator_add(const char *name, u_int8_t type, const char *arg) switch (val->type) { case KORE_VALIDATOR_TYPE_REGEX: - if (regcomp(&(val->rctx), arg, REG_EXTENDED | REG_NOSUB)) { + ret = regcomp(&(val->rctx), arg, REG_EXTENDED | REG_NOSUB); + if (ret) { kore_free(val); kore_log(LOG_NOTICE, - "validator %s has bad regex %s", name, arg); + "validator %s has bad regex %s (%d)", + name, arg, ret); return (KORE_RESULT_ERROR); } break;