-
-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
imemory_ondisk: Don't fail write under any circumstances if locking is disabled #2791
Conversation
libafl/src/corpus/inmemory_ondisk.rs
Outdated
} | ||
} else if let Err(error) = self.store_input_from(testcase) { | ||
log::error!( | ||
"An error occurred when trying to write a testcase without locking: {}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is like a format string, right? So we can do
"An error occurred when trying to write a testcase without locking: {err}",
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Micro optimization, but the whole thing could be
if let Err(err) = self.store_input_from(testcase) {
if self.locking {
return Err(err);
}
log::error!("An error occurred when trying to write a testcase without locking: {err}",
}
then you only need to check the extra condition in the error case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
applied.
Feel free to merge. As stated elsewhere, #2434 would be the proper fix, though :) |
…s disabled (AFLplusplus#2791) * imemory_ondisk: Don't fail write under any circumstances if locking is disabled * fmt * inmemory_ondisk: Add a log message on failure * clippy' * micro optimization
This is necessary if you want to disable locking for a corpus.