--- l2_ch_filter.c 2001/09/25 09:35:17 1.9
+++ l2_ch_filter.c 2001/09/28 14:28:41 1.10
@@ -83,7 +83,8 @@
return L2_ERR_ARG;
}
/* study FSM for more performance */
- if ((cfg->pcreExtra = pcre_study(cfg->pcreRegex, 0, &szError)) == NULL) {
+ cfg->pcreExtra = pcre_study(cfg->pcreRegex, 0, &szError);
+ if (szError != NULL) {
free(cfg->pcreRegex);
cfg->pcreRegex = NULL;
l2_channel_errorinfo(ch, L2_ERR_ARG, "%s", szError);
@@ -101,13 +102,14 @@
l2_ch_filter_t *cfg = (l2_ch_filter_t *)ctx->vp;
l2_channel_t *downstream = l2_channel_downstream(ch);
l2_result_t rv;
- int bPass;
+ int bPass, iCheck;
bPass = TRUE;
/* apply filter */
- if (cfg->pcreRegex != NULL && cfg->pcreExtra != NULL) {
- if (pcre_exec(cfg->pcreRegex, cfg->pcreExtra, buf, buf_size, 0, 0, NULL, 0) > 0)
+ if (cfg->pcreRegex != NULL) {
+ iCheck = pcre_exec(cfg->pcreRegex, cfg->pcreExtra, buf, buf_size, 0, 0, NULL, 0);
+ if (iCheck >= 0)
bPass = TRUE;
else
bPass = FALSE;
|