mirror of
https://github.com/falcosecurity/falco.git
synced 2025-09-01 14:47:00 +00:00
refactor(userspace/falco): remove duplicate condition test
handled is test a second time for the same while it's already part of the initial entry condition. Signed-off-by: Samuel Gaist <samuel.gaist@idiap.ch>
This commit is contained in:
@@ -85,23 +85,21 @@ public:
|
|||||||
inline bool handle(std::function<void()> f) {
|
inline bool handle(std::function<void()> f) {
|
||||||
if(triggered() && !handled()) {
|
if(triggered() && !handled()) {
|
||||||
std::unique_lock<std::mutex> lock(m_mtx);
|
std::unique_lock<std::mutex> lock(m_mtx);
|
||||||
if(!handled()) {
|
try {
|
||||||
try {
|
f();
|
||||||
f();
|
// note: the action may have forcely reset
|
||||||
// note: the action may have forcely reset
|
// the signal handler, so we don't want to create
|
||||||
// the signal handler, so we don't want to create
|
// an inconsistent state
|
||||||
// an inconsistent state
|
if(triggered()) {
|
||||||
if(triggered()) {
|
m_handled.store(true, std::memory_order_seq_cst);
|
||||||
m_handled.store(true, std::memory_order_seq_cst);
|
|
||||||
}
|
|
||||||
} catch(std::exception&) {
|
|
||||||
if(triggered()) {
|
|
||||||
m_handled.store(true, std::memory_order_seq_cst);
|
|
||||||
}
|
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
return true;
|
} catch(std::exception&) {
|
||||||
|
if(triggered()) {
|
||||||
|
m_handled.store(true, std::memory_order_seq_cst);
|
||||||
|
}
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user