Do not do any setup if opt_api_listen is disabled in api.c.
diff --git a/api.c b/api.c
index 5a4d718..ac1713c 100644
--- a/api.c
+++ b/api.c
@@ -3482,16 +3482,16 @@ void api(int api_thr_id)
bool did;
int i;
- mutex_init(&quit_restart_lock);
-
- pthread_cleanup_push(tidyup, NULL);
- my_thr_id = api_thr_id;
-
if (!opt_api_listen) {
applog(LOG_DEBUG, "API not running%s", UNAVAILABLE);
return;
}
+ mutex_init(&quit_restart_lock);
+
+ pthread_cleanup_push(tidyup, NULL);
+ my_thr_id = api_thr_id;
+
setup_groups();
if (opt_api_allow) {