summaryrefslogtreecommitdiff
path: root/ubusd_obj.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-02-05 19:53:14 +0100
committerFelix Fietkau <nbd@openwrt.org>2011-02-05 19:53:14 +0100
commitf6a6b0d492900b7a087a8a89d11fa5b94f4c5cb5 (patch)
tree860fa15e47025bca702bfb36fbec26b50313bca6 /ubusd_obj.c
parentfa989780bda3ad10fcbb637390d59afe2b32ba81 (diff)
downloadubus-f6a6b0d492900b7a087a8a89d11fa5b94f4c5cb5.tar.gz
add functionality for registering anonymous objects as event listeners
Diffstat (limited to 'ubusd_obj.c')
-rw-r--r--ubusd_obj.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ubusd_obj.c b/ubusd_obj.c
index a6be182..15f43ad 100644
--- a/ubusd_obj.c
+++ b/ubusd_obj.c
@@ -118,11 +118,12 @@ struct ubus_object *ubusd_create_object(struct ubus_client *cl, struct blob_attr
else if (attr[UBUS_ATTR_SIGNATURE])
type = ubus_create_obj_type(attr[UBUS_ATTR_SIGNATURE]);
- if (!type)
+ if (!!type ^ !!attr[UBUS_ATTR_OBJPATH])
return NULL;
obj = ubusd_create_object_internal(type, 0);
- ubus_unref_object_type(type);
+ if (type)
+ ubus_unref_object_type(type);
if (!obj)
return NULL;
@@ -141,6 +142,8 @@ struct ubus_object *ubusd_create_object(struct ubus_client *cl, struct blob_attr
obj->client = cl;
list_add(&obj->list, &cl->objects);
+ INIT_LIST_HEAD(&obj->events);
+
return obj;
free:
@@ -150,6 +153,7 @@ free:
void ubusd_free_object(struct ubus_object *obj)
{
+ ubusd_event_cleanup_object(obj);
if (obj->path.key) {
avl_delete(&path, &obj->path);
free(obj->path.key);