diff --git a/bpf/aya-bpf/src/maps/hash_map.rs b/bpf/aya-bpf/src/maps/hash_map.rs index 13aa1aed..35383e05 100644 --- a/bpf/aya-bpf/src/maps/hash_map.rs +++ b/bpf/aya-bpf/src/maps/hash_map.rs @@ -354,5 +354,5 @@ fn insert(def: *mut bpf_map_def, key: &K, value: &V, flags: u64) -> Result #[inline] fn remove(def: *mut bpf_map_def, key: &K) -> Result<(), c_long> { let ret = unsafe { bpf_map_delete_elem(def as *mut _, key as *const _ as *const c_void) }; - (ret >= 0).then(|| ()).ok_or(ret) + (ret == 0).then(|| ()).ok_or(ret) } diff --git a/bpf/aya-bpf/src/maps/lpm_trie.rs b/bpf/aya-bpf/src/maps/lpm_trie.rs index b0eeefb3..bbe6662e 100644 --- a/bpf/aya-bpf/src/maps/lpm_trie.rs +++ b/bpf/aya-bpf/src/maps/lpm_trie.rs @@ -86,7 +86,7 @@ impl LpmTrie { let ret = unsafe { bpf_map_delete_elem(self.def.get() as *mut _, key as *const _ as *const c_void) }; - (ret >= 0).then(|| ()).ok_or(ret) + (ret == 0).then(|| ()).ok_or(ret) } }