diff --git a/lib/hook.c b/lib/hook.c index 3353a6fb7..f1439d626 100644 --- a/lib/hook.c +++ b/lib/hook.c @@ -187,11 +187,11 @@ int hook_parse_list(struct list *list, config_setting_t *cfg, struct path *o) ret = hook_init(h, &p->hook, o); if (ret) - continue; + cerror(cfg_hook, "Failed to initialize hook"); ret = hook_parse(h, cfg_hook); if (ret) - continue; + cerror(cfg_hook, "Failed to parse hook configuration"); list_push(list, h); } diff --git a/lib/hooks/stats_collect.c b/lib/hooks/stats_collect.c index dd3ed94e9..8fc7e7ab2 100644 --- a/lib/hooks/stats_collect.c +++ b/lib/hooks/stats_collect.c @@ -59,8 +59,8 @@ static int stats_collect_init(struct hook *h) p->buckets = 20; p->uri = NULL; p->output = stdout; - - return 0; + + return stats_init(&p->stats, p->buckets, p->warmup); } static int stats_collect_destroy(struct hook *h) @@ -74,7 +74,7 @@ static int stats_collect_start(struct hook *h) { struct stats_collect *p = h->_vd; - stats_init(&p->stats, p->buckets, p->warmup); + if (p->uri) { p->output = fopen(p->uri, "w+"); diff --git a/src/hook.c b/src/hook.c index 78f35121c..59a394191 100644 --- a/src/hook.c +++ b/src/hook.c @@ -161,7 +161,9 @@ int main(int argc, char *argv[]) if (ret) error("Failed to parse hook config"); - hook_start(&h); + ret = hook_start(&h); + if (ret) + error("Failed to start hook"); while (!feof(stdin)) { ret = sample_alloc(&q, samples, cnt); @@ -190,8 +192,14 @@ int main(int argc, char *argv[]) sample_free(samples, cnt); } - hook_stop(&h); - hook_destroy(&h); + ret = hook_stop(&h); + if (ret) + error("Failed to stop hook"); + + ret = hook_destroy(&h); + if (ret) + error("Failed to destroy hook"); + config_destroy(&cfg); sample_free(samples, cnt);