X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fubus.git;a=blobdiff_plain;f=ubusd_event.c;h=6d0ae3014d7e5ef69254d94ff6579e8a98fca308;hp=11b51eeeeb91d7f152e4bc33ec13a9373bf7dd83;hb=ba607d976b77c40162637d354fd8e1560384a66d;hpb=42bc27ae38d92f4fe11872b0f9d57f8d3578dcfe diff --git a/ubusd_event.c b/ubusd_event.c index 11b51ee..6d0ae30 100644 --- a/ubusd_event.c +++ b/ubusd_event.c @@ -134,7 +134,7 @@ static void ubusd_send_event_msg(struct ubus_msg_buf **ub, struct ubus_client *c ubus_msg_send(obj->client, *ub, false); } -bool strmatch_len(const char *s1, const char *s2, int *len) +static bool strmatch_len(const char *s1, const char *s2, int *len) { for (*len = 0; s1[*len] == s2[*len]; (*len)++) if (!s1[*len]) @@ -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; }