static struct ubus_context *ctx = NULL;
static struct blob_buf b;
-static struct netifd_fd ubus_fd;
static const char *ubus_path;
/* global object */
netifd_ubus_add_fd(void)
{
ubus_add_uloop(ctx);
- ubus_fd.fd = ctx->sock.fd;
- netifd_fd_add(&ubus_fd);
+ system_fd_set_cloexec(ctx->sock.fd);
}
static void
static void
netifd_ubus_connection_lost(struct ubus_context *ctx)
{
- netifd_fd_delete(&ubus_fd);
netifd_ubus_reconnect_timer(NULL);
}
device_lock();
dev = device_get(blobmsg_data(tb[DEV_NAME]), add ? 2 : 0);
- if (add && !dev)
- return UBUS_STATUS_NOT_FOUND;
+ if (!dev) {
+ ret = UBUS_STATUS_NOT_FOUND;
+ goto out;
+ }
if (add) {
device_set_present(dev, true);
ret = interface_remove_link(iface, dev);
}
+out:
device_unlock();
return ret;
struct ubus_object *obj = &iface->ubus;
char *name = NULL;
- asprintf(&name, "%s.interface.%s", main_object.name, iface->name);
- if (!name)
+ if (asprintf(&name, "%s.interface.%s", main_object.name, iface->name) == -1)
return;
obj->name = name;