diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2023-01-05 17:10:35 +0100 |
---|---|---|
committer | pespin <pespin@sysmocom.de> | 2023-01-11 15:33:41 +0000 |
commit | e709bd4814020146baff2538ea50dbbc96432ff0 (patch) | |
tree | 880ba5886ff7c7f506686e085b5d2be0f607c7a2 /src | |
parent | 555c293867e776782bed3f52d00e092ab949901c (diff) |
ctrl: error if program forgot to initialize the ctr handler before installing cmds
Change-Id: Icf3873f33470499fed3150ff51922a36aa0f023e
Diffstat (limited to 'src')
-rw-r--r-- | src/ctrl/control_cmd.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c index b069ca46..dec19b9b 100644 --- a/src/ctrl/control_cmd.c +++ b/src/ctrl/control_cmd.c @@ -210,6 +210,16 @@ int ctrl_cmd_install(enum ctrl_node_type node, struct ctrl_cmd_element *cmd) { vector cmds_vec; + /* If this assert triggers, it means the program forgot to initialize + * the CTRL interface first by calling ctrl_handle_alloc(2)() directly + * or indirectly through ctrl_interface_setup_dynip(2)() + */ + if (!ctrl_node_vec) { + LOGP(DLCTRL, LOGL_ERROR, + "ctrl_handle must be initialized prior to installing cmds.\n"); + return -ENODEV; + } + cmds_vec = vector_lookup_ensure(ctrl_node_vec, node); if (!cmds_vec) { |