CMakeLists.txt: bump minimum cmake version
[project/ubus.git] / libubus.c
index 7ce454eabc648bcafccf3e6f5248c31228897b68..c9c3c6e5c2484b23b06ffc2407f2cbc476b6eb62 100644 (file)
--- a/libubus.c
+++ b/libubus.c
@@ -34,6 +34,9 @@ const char *__ubus_strerror[__UBUS_STATUS_LAST] = {
        [UBUS_STATUS_NOT_SUPPORTED] = "Operation not supported",
        [UBUS_STATUS_UNKNOWN_ERROR] = "Unknown error",
        [UBUS_STATUS_CONNECTION_FAILED] = "Connection failed",
+       [UBUS_STATUS_NO_MEMORY] = "Out of memory",
+       [UBUS_STATUS_PARSE_ERROR] = "Parsing message data failed",
+       [UBUS_STATUS_SYSTEM_ERROR] = "System error",
 };
 
 struct blob_buf b __hidden = {};
@@ -103,7 +106,9 @@ ubus_process_msg(struct ubus_context *ctx, struct ubus_msghdr_buf *buf, int fd)
                        break;
                }
 
+               ctx->stack_depth++;
                ubus_process_obj_msg(ctx, buf, fd);
+               ctx->stack_depth--;
                break;
        case UBUS_MSG_MONITOR:
                if (ctx->monitor_cb)
@@ -293,6 +298,7 @@ int ubus_connect_ctx(struct ubus_context *ctx, const char *path)
 
        INIT_LIST_HEAD(&ctx->requests);
        INIT_LIST_HEAD(&ctx->pending);
+       INIT_LIST_HEAD(&ctx->auto_subscribers);
        avl_init(&ctx->objects, ubus_cmp_id, false, NULL);
        if (ubus_reconnect(ctx, path)) {
                free(ctx->msgbuf.data);
@@ -363,6 +369,7 @@ void ubus_shutdown(struct ubus_context *ctx)
        blob_buf_free(&b);
        if (!ctx)
                return;
+       uloop_fd_delete(&ctx->sock);
        close(ctx->sock.fd);
        uloop_timeout_cancel(&ctx->pending_timer);
        free(ctx->msgbuf.data);