From 4c354ebf35dfb3b085df240fac6b67801af648ec Mon Sep 17 00:00:00 2001 From: Ariadne Conill Date: Thu, 8 Oct 2020 02:17:13 -0600 Subject: [PATCH] ifquery: implement more robust loop breaking strategy --- cmd/ifquery.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cmd/ifquery.c b/cmd/ifquery.c index 9eb1f58..f62a58b 100644 --- a/cmd/ifquery.c +++ b/cmd/ifquery.c @@ -63,9 +63,6 @@ print_interface_dot(struct lif_dict *collection, struct lif_interface *iface, st if (!lif_lifecycle_query_dependents(&exec_opts, iface, iface->ifname)) return; - if (iface->refcount > 0) - return; - if (parent != NULL) printf("\"%s (%zu)\" -> ", parent->ifname, parent->rdepends_count); @@ -86,8 +83,12 @@ print_interface_dot(struct lif_dict *collection, struct lif_interface *iface, st { struct lif_interface *child_if = lif_interface_collection_find(collection, tokenp); + if (child_if->is_pending) + continue; + + child_if->is_pending = true; print_interface_dot(collection, child_if, iface); - child_if->refcount++; + child_if->is_pending = false; } }