From 16e21f6b33c40895cda27af4bc9f3bd0136d2482 Mon Sep 17 00:00:00 2001 From: Nathan Hintz Date: Sat, 5 Jan 2013 18:41:45 -0800 Subject: [PATCH] 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 --- ubus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } -- 2.11.0