diff options
Diffstat (limited to 'plugins/check_curl.c')
-rw-r--r-- | plugins/check_curl.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c index f28bcdfc..ba38854a 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c | |||
@@ -1261,9 +1261,8 @@ mp_state_enum check_http(const check_curl_config config, check_curl_working_stat | |||
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | if (strlen(config.regexp)) { | 1263 | if (strlen(config.regexp)) { |
1264 | regex_t preg; | ||
1265 | regmatch_t pmatch[REGS]; | 1264 | regmatch_t pmatch[REGS]; |
1266 | int errcode = regexec(&preg, global_state.body_buf.buf, REGS, pmatch, 0); | 1265 | int errcode = regexec(&config.compiled_regex, global_state.body_buf.buf, REGS, pmatch, 0); |
1267 | if ((errcode == 0 && !config.invert_regex) || | 1266 | if ((errcode == 0 && !config.invert_regex) || |
1268 | (errcode == REG_NOMATCH && config.invert_regex)) { | 1267 | (errcode == REG_NOMATCH && config.invert_regex)) { |
1269 | /* OK - No-op to avoid changing the logic around it */ | 1268 | /* OK - No-op to avoid changing the logic around it */ |
@@ -1284,7 +1283,7 @@ mp_state_enum check_http(const check_curl_config config, check_curl_working_stat | |||
1284 | } | 1283 | } |
1285 | result = config.state_regex; | 1284 | result = config.state_regex; |
1286 | } else { | 1285 | } else { |
1287 | regerror(errcode, &preg, errbuf, MAX_INPUT_BUFFER); | 1286 | regerror(errcode, &config.compiled_regex, errbuf, MAX_INPUT_BUFFER); |
1288 | 1287 | ||
1289 | char tmp[DEFAULT_BUFFER_SIZE]; | 1288 | char tmp[DEFAULT_BUFFER_SIZE]; |
1290 | 1289 | ||
@@ -1969,6 +1968,8 @@ check_curl_config_wrapper process_arguments(int argc, char **argv) { | |||
1969 | result.errorcode = ERROR; | 1968 | result.errorcode = ERROR; |
1970 | return result; | 1969 | return result; |
1971 | } | 1970 | } |
1971 | |||
1972 | result.config.compiled_regex = preg; | ||
1972 | break; | 1973 | break; |
1973 | case INVERT_REGEX: | 1974 | case INVERT_REGEX: |
1974 | result.config.invert_regex = true; | 1975 | result.config.invert_regex = true; |