diff options
author | Thomas Haller <thaller@redhat.com> | 2020-04-17 15:01:57 (GMT) |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2020-04-17 15:54:06 (GMT) |
commit | 5020077d271a918b989d5d46d664992a88c7c69b (patch) | |
tree | dc165523f5ab824c3a73be755a0f0275ea3fed0a /lib/object.c | |
parent | 406ebc8436e191d34c365ee2183421511d369e52 (diff) | |
download | libnl-5020077d271a918b989d5d46d664992a88c7c69b.zip libnl-5020077d271a918b989d5d46d664992a88c7c69b.tar.gz libnl-5020077d271a918b989d5d46d664992a88c7c69b.tar.bz2 |
lib: let nl_object_identical() declare the same object as identical
nl_object_identical() only considers two objects as identical, if all
their ID attributes are set. That means, two objects that are
incomplete (with unset ID attributes) never compare identical.
That cannot be right. At least not if both objects are the very same
pointer.
That is also important for nl_cache_clear() and nl_cache_remove(). An
object must be identical to itself, otherwise it cannot be removed from
the cache anymore.
Diffstat (limited to 'lib/object.c')
-rw-r--r-- | lib/object.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/object.c b/lib/object.c index 821436d..18497f4 100644 --- a/lib/object.c +++ b/lib/object.c @@ -309,6 +309,9 @@ int nl_object_identical(struct nl_object *a, struct nl_object *b) struct nl_object_ops *ops = obj_ops(a); uint32_t req_attrs; + if (a == b) + return 1; + /* Both objects must be of same type */ if (ops != obj_ops(b)) return 0; |