*
* \author Breno Silva Pinto <breno.silva@gmail.com>
*
- * \todo Need to support suppress
- *
* Implements Threshold support
*/
filename = SCThresholdConfGetConfFilename(de_ctx);
if ( (fd = fopen(filename, "r")) == NULL) {
SCLogWarning("Error opening file: \"%s\": %s", filename, strerror(errno));
- goto error;
+ SCThresholdConfDeInitContext(de_ctx, fd);
+ return 0;
}
#ifdef UNITTESTS
}
if (SCThresholdConfParseFile(de_ctx, fd) < 0) {
SCLogWarning("Error loading threshold configuration from %s", filename);
+ SCThresholdConfDeInitContext(de_ctx, fd);
/* maintain legacy behavior so no errors unless config testing */
if (RunmodeGetCurrent() == RUNMODE_CONF_TEST) {
ret = -1;
}
- goto error;
+ return ret;
}
SCThresholdConfDeInitContext(de_ctx, fd);
#endif
SCLogDebug("Global thresholding options defined");
return 0;
-
-error:
- SCThresholdConfDeInitContext(de_ctx, fd);
-
-return ret;
}
/**
char *th_ip = NULL;
uint32_t id = 0, gid = 0;
- int r = 0;
- r = ParseThresholdRule(de_ctx, rawstr, &id, &gid, &parsed_type, &parsed_track,
- &parsed_count, &parsed_seconds, &parsed_timeout, &parsed_new_action,
- &th_ip);
+ int r = ParseThresholdRule(de_ctx, rawstr, &id, &gid, &parsed_type, &parsed_track,
+ &parsed_count, &parsed_seconds, &parsed_timeout, &parsed_new_action, &th_ip);
if (r < 0)
goto error;
}
SCLogInfo("Threshold config parsed: %d rule(s) found", rule_num);
-
return 0;
}