summaryrefslogtreecommitdiff
path: root/ubus.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-10-12 16:07:46 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-10-12 16:07:46 +0200
commitab98d23a5c70c77fce399a95741644a894d0905a (patch)
treeeb178ee12e32ad4ec29be542a2bc071614acdf2a /ubus.c
parentd64c608820ddb4817ef7dff1f993a5801ff99ca2 (diff)
downloadnetifd-ab98d23a5c70c77fce399a95741644a894d0905a.tar.gz
fix network interface object name
Diffstat (limited to 'ubus.c')
-rw-r--r--ubus.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ubus.c b/ubus.c
index 8c237c3..c9b10e8 100644
--- a/ubus.c
+++ b/ubus.c
@@ -336,13 +336,12 @@ void
netifd_ubus_add_interface(struct interface *iface)
{
struct ubus_object *obj = &iface->ubus;
- char *name;
+ char *name = NULL;
- name = malloc(strlen(main_object.name) + strlen(iface->name) + 2);
+ asprintf(&name, "%s.interface.%s", main_object.name, iface->name);
if (!name)
return;
- sprintf(name, "%s.%s", main_object.name, iface->name);
obj->name = name;
obj->type = &iface_object_type;
obj->methods = iface_object_methods;