diff options
Diffstat (limited to 'monkey/dispatch.c')
-rw-r--r-- | monkey/dispatch.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/monkey/dispatch.c b/monkey/dispatch.c index 9d022560c..c70070d4e 100644 --- a/monkey/dispatch.c +++ b/monkey/dispatch.c @@ -35,15 +35,18 @@ typedef struct cmdhandler { static monkey_cmdhandler_t *handler_ring = NULL; -void +nserror monkey_register_handler(const char *cmd, handle_command_fn fn) { monkey_cmdhandler_t *ret = calloc(sizeof(*ret), 1); - if (ret == NULL) - die("Unable to allocate handler"); + if (ret == NULL) { + LOG(("Unable to allocate handler")); + return NSERROR_NOMEM; + } ret->cmd = strdup(cmd); ret->fn = fn; RING_INSERT(handler_ring, ret); + return NSERROR_OK; } void |