diff --git a/lib/hook_list.cpp b/lib/hook_list.cpp index 6e3b23f05..5c94f5ca0 100644 --- a/lib/hook_list.cpp +++ b/lib/hook_list.cpp @@ -109,6 +109,9 @@ int hook_list_prepare(vlist *hs, vlist *sigs, int m, struct path *p, struct node { assert(hs->state == STATE_INITIALIZED); + if (!m) + goto skip_add; + /* Add internal hooks if they are not already in the list */ for (auto f : plugin::Registry::lookup()) { if ((f->getFlags() & m) == m) { @@ -118,6 +121,7 @@ int hook_list_prepare(vlist *hs, vlist *sigs, int m, struct path *p, struct node } } +skip_add: /* We sort the hooks according to their priority */ vlist_sort(hs, (cmp_cb_t) hook_cmp_priority); diff --git a/lib/node_direction.c b/lib/node_direction.c index b7b52af7b..5490a2351 100644 --- a/lib/node_direction.c +++ b/lib/node_direction.c @@ -221,11 +221,12 @@ int node_direction_stop(struct node_direction *nd, struct node *n) struct vlist * node_direction_get_signals(struct node_direction *nd) { -#ifdef WITH_HOOKS assert(nd->state == STATE_PREPARED); - return hook_list_get_signals(&nd->hooks); -#else - return &nd->signals; +#ifdef WITH_HOOKS + if (vlist_length(&nd->hooks) > 0) + return hook_list_get_signals(&nd->hooks); #endif + + return &nd->signals; }