pespin has submitted this change. ( https://gerrit.osmocom.org/c/libosmocore/+/30877 )
Change subject: ctrl: error if program forgot to initialize the ctr handler before installing cmds ......................................................................
ctrl: error if program forgot to initialize the ctr handler before installing cmds
Change-Id: Icf3873f33470499fed3150ff51922a36aa0f023e --- M src/ctrl/control_cmd.c 1 file changed, 10 insertions(+), 0 deletions(-)
Approvals: daniel: Looks good to me, approved fixeria: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/src/ctrl/control_cmd.c b/src/ctrl/control_cmd.c index b069ca4..dec19b9 100644 --- a/src/ctrl/control_cmd.c +++ b/src/ctrl/control_cmd.c @@ -210,6 +210,16 @@ { 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) {