pass ubus_msg_buf to callback of internal object
[project/ubus.git] / ubusd_event.c
index 85031a6..6d0ae30 100644 (file)
@@ -228,7 +228,7 @@ static int ubusd_forward_event(struct ubus_client *cl, struct blob_attr *msg)
        return ubusd_send_event(cl, id, ubusd_create_event_from_msg, data);
 }
 
-static int ubusd_event_recv(struct ubus_client *cl, const char *method, struct blob_attr *msg)
+static int ubusd_event_recv(struct ubus_client *cl, struct ubus_msg_buf *ub, const char *method, struct blob_attr *msg)
 {
        if (!strcmp(method, "register"))
                return ubusd_alloc_event_pattern(cl, msg);
@@ -267,6 +267,7 @@ void ubusd_event_init(void)
 {
        ubus_init_string_tree(&patterns, true);
        event_obj = ubusd_create_object_internal(NULL, UBUS_SYSTEM_OBJECT_EVENT);
-       event_obj->recv_msg = ubusd_event_recv;
+       if (event_obj != NULL)
+               event_obj->recv_msg = ubusd_event_recv;
 }