From: Nathan Hintz Date: Sun, 6 Jan 2013 02:41:45 +0000 (-0800) Subject: fix removal of unknown device X-Git-Url: https://git.archive.openwrt.org/?p=project%2Fnetifd.git;a=commitdiff_plain;h=16e21f6b33c40895cda27af4bc9f3bd0136d2482;ds=inline fix removal of unknown device Netifd will crash if an attempt is made to remove a device that is not known to netifd. For instance: ubus call network.interface.lan remove_device "{ \"name\": \"xxx\" }" Signed-off-by: Nathan Hintz --- diff --git a/ubus.c b/ubus.c index d6d4188..2b92c78 100644 --- a/ubus.c +++ b/ubus.c @@ -592,7 +592,7 @@ netifd_iface_handle_device(struct ubus_context *ctx, struct ubus_object *obj, device_lock(); dev = device_get(blobmsg_data(tb[DEV_NAME]), add ? 2 : 0); - if (add && !dev) { + if (!dev) { ret = UBUS_STATUS_NOT_FOUND; goto out; }