diff options
author | Patrick McHardy <kaber@trash.net> | 2010-04-07 19:16:22 +0200 |
---|---|---|
committer | Thomas Graf <tgraf@suug.ch> | 2010-04-19 12:42:27 +0200 |
commit | ba1bd9050d0373239dfc400815e275d169dee415 (patch) | |
tree | 4ed7f1bb74506b4f64a3253b8ba16322777ede59 | |
parent | 52d6b8b9ee21b4bc112cc8a5d6f440536dd7fde0 (diff) | |
download | libnl-ba1bd9050d0373239dfc400815e275d169dee415.tar.gz |
cache: properly invoke change_cb for deleted objects in nl_cache_resync()
When resyncing a cache, there are no delete messages, so they need to
be synthesized for deleted objects.
Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r-- | lib/cache.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/cache.c b/lib/cache.c index 1d44390..5fab32a 100644 --- a/lib/cache.c +++ b/lib/cache.c @@ -605,9 +605,15 @@ int nl_cache_resync(struct nl_sock *sk, struct nl_cache *cache, if (err < 0) goto errout; - nl_list_for_each_entry_safe(obj, next, &cache->c_items, ce_list) - if (nl_object_is_marked(obj)) + nl_list_for_each_entry_safe(obj, next, &cache->c_items, ce_list) { + if (nl_object_is_marked(obj)) { + nl_object_get(obj); nl_cache_remove(obj); + if (change_cb) + change_cb(cache, obj, NL_ACT_DEL); + nl_object_put(obj); + } + } NL_DBG(1, "Finished resyncing %p <%s>\n", cache, nl_cache_name(cache)); |