zeek-setup: Exit when rule loading tickles reporter errors

With custom events for signatures, Reporter::error() may be invoked
while loading them. Early exit in case that happens. We could continue
and either disable the signatures or fallback to the default
signature_match() event, but not sure that would be obviously better.
This commit is contained in:
Arne Welzel 2023-11-29 19:38:19 +01:00
parent b795c0bfc1
commit d11ac929af

View file

@ -891,7 +891,7 @@ SetupResult setup(int argc, char** argv, Options* zopts) {
if ( ! all_signature_files.empty() ) { if ( ! all_signature_files.empty() ) {
rule_matcher = new RuleMatcher(options.signature_re_level); rule_matcher = new RuleMatcher(options.signature_re_level);
if ( ! rule_matcher->ReadFiles(all_signature_files) ) { if ( ! rule_matcher->ReadFiles(all_signature_files) || zeek::reporter->Errors() > 0 ) {
early_shutdown(); early_shutdown();
exit(1); exit(1);
} }