Skip to content

Commit

Permalink
Move fr_command_register_hook call inside the HAVE_PTHREAD_H ifdef
Browse files Browse the repository at this point in the history
We only spawn workers if we're built with threads, and the list is life uninitialised otherwise
  • Loading branch information
arr2036 committed Sep 26, 2018
1 parent 5c4a1bd commit da0d7b8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/io/schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,6 @@ fr_schedule_t *fr_schedule_create(TALLOC_CTX *ctx, fr_event_list_t *el,
fr_schedule_destroy(sc);
return NULL;
}
#endif

for (sw = fr_dlist_head(&sc->workers), i = 0;
sw != NULL;
Expand All @@ -568,6 +567,7 @@ fr_schedule_t *fr_schedule_create(TALLOC_CTX *ctx, fr_event_list_t *el,
goto st_fail;
}
}
#endif

if (fr_command_register_hook(NULL, "0", sc->sn->nr, cmd_network_table) < 0) {
fr_log(sc->log, L_ERR, "Failed adding network commands: %s", fr_strerror());
Expand Down Expand Up @@ -608,6 +608,7 @@ int fr_schedule_destroy(fr_schedule_t *sc)
goto done;
}

rad_assert(sc->sn);
rad_assert(sc->num_workers > 0);

/*
Expand Down

0 comments on commit da0d7b8

Please sign in to comment.