Fix YARA compiler builder pattern usage

The add_rules_str() method consumes self and returns a new Compiler,
following a builder pattern. Updated to reassign the returned compiler
instead of treating it as a mutable method.

This fixes the compilation error when building with yara-scanning feature.
This commit is contained in:
pandaadir05
2025-11-21 14:32:39 +02:00
parent d09429ea2e
commit 7a2e6f222d

View File

@@ -171,10 +171,13 @@ impl DynamicYaraEngine {
.and_then(|s| s.to_str())
.unwrap_or("default");
if let Err(e) = compiler.add_rules_str(&content) {
compiler = match compiler.add_rules_str(&content) {
Ok(c) => c,
Err(e) => {
log::error!("Failed to compile {}: {}", rule_file.display(), e);
continue;
}
};
log::info!("Compiled YARA rule: {}", rule_file.display());