Fix error checking in __system_property_foreach() implementation.
C++ hid the mistake created when the return type changed from int to bool but the callers weren't updated.
Bug: https://issuetracker.google.com/350285643
Signed-off-by: <superman.xpt@gmail.com>
Change-Id: I930b41d76c878f7e677eb7bd3b9663bc211471c4
diff --git a/libc/system_properties/prop_area.cpp b/libc/system_properties/prop_area.cpp
index a816a38..9b153ca 100644
--- a/libc/system_properties/prop_area.cpp
+++ b/libc/system_properties/prop_area.cpp
@@ -339,8 +339,7 @@
uint_least32_t left_offset = atomic_load_explicit(&trie->left, memory_order_relaxed);
if (left_offset != 0) {
- const int err = foreach_property(to_prop_trie_node(&trie->left), propfn, cookie);
- if (err < 0) return false;
+ if (!foreach_property(to_prop_trie_node(&trie->left), propfn, cookie)) return false;
}
uint_least32_t prop_offset = atomic_load_explicit(&trie->prop, memory_order_relaxed);
if (prop_offset != 0) {
@@ -350,13 +349,11 @@
}
uint_least32_t children_offset = atomic_load_explicit(&trie->children, memory_order_relaxed);
if (children_offset != 0) {
- const int err = foreach_property(to_prop_trie_node(&trie->children), propfn, cookie);
- if (err < 0) return false;
+ if (!foreach_property(to_prop_trie_node(&trie->children), propfn, cookie)) return false;
}
uint_least32_t right_offset = atomic_load_explicit(&trie->right, memory_order_relaxed);
if (right_offset != 0) {
- const int err = foreach_property(to_prop_trie_node(&trie->right), propfn, cookie);
- if (err < 0) return false;
+ if (!foreach_property(to_prop_trie_node(&trie->right), propfn, cookie)) return false;
}
return true;
@@ -371,6 +368,6 @@
return find_property(root_node(), name, namelen, value, valuelen, true);
}
-bool prop_area::foreach (void (*propfn)(const prop_info* pi, void* cookie), void* cookie) {
+bool prop_area::foreach(void (*propfn)(const prop_info* pi, void* cookie), void* cookie) {
return foreach_property(root_node(), propfn, cookie);
}