Merge pull request #794 from c3d/bug/793-bad-match

rust-agent: Replaces improper use of match for non-constant patterns
This commit is contained in:
Peng Tao 2020-09-30 20:39:45 +08:00 committed by GitHub
commit ec09971d8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,19 +103,16 @@ fn register_memory_event_v2(
} }
info!(sl!(), "event.wd: {:?}", event.wd); info!(sl!(), "event.wd: {:?}", event.wd);
match event.wd { if event.wd == ev_fd {
ev_fd => { let oom = get_value_from_cgroup(&event_control_path, "oom_kill");
let oom = get_value_from_cgroup(&event_control_path, "oom_kill"); if oom.unwrap_or(0) > 0 {
if oom.unwrap_or(0) > 0 { sender.send(containere_id.clone()).unwrap();
sender.send(containere_id.clone()).unwrap(); return;
return;
}
} }
cg_fd => { } else if event.wd == cg_fd {
let pids = get_value_from_cgroup(&cgroup_event_control_path, "populated"); let pids = get_value_from_cgroup(&cgroup_event_control_path, "populated");
if pids.unwrap_or(-1) == 0 { if pids.unwrap_or(-1) == 0 {
return; return;
}
} }
} }
} }