summaryrefslogtreecommitdiffstats
path: root/service.c
diff options
context:
space:
mode:
authorJohn Crispin <blogic@openwrt.org>2013-07-09 17:23:33 +0200
committerJohn Crispin <blogic@openwrt.org>2013-07-09 17:25:34 +0200
commitd8695bda1728d205fd76a4a5f8b329de418928dc (patch)
tree08295c0a370090bcf923f6c597dac804a7f62cad /service.c
parent84c114b0756eaff7caf2693c61bdc307a080558c (diff)
downloadunitd-d8695bda1728d205fd76a4a5f8b329de418928dc.tar
unitd-d8695bda1728d205fd76a4a5f8b329de418928dc.zip
the delete handle should return an error if no service is named instead of killing all services
Signed-off-by: John Crispin <blogic@openwrt.org>
Diffstat (limited to 'service.c')
-rw-r--r--service.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/service.c b/service.c
index ffbc584..b5f4f3e 100644
--- a/service.c
+++ b/service.c
@@ -254,17 +254,14 @@ service_handle_delete(struct ubus_context *ctx, struct ubus_object *obj,
struct blob_attr *msg)
{
struct blob_attr *tb[__SERVICE_DEL_ATTR_MAX], *cur;
- struct service *s, *tmp;
+ struct service *s;
struct service_instance *in;
blobmsg_parse(service_del_attrs, __SERVICE_DEL_ATTR_MAX, tb, blob_data(msg), blob_len(msg));
cur = tb[SERVICE_DEL_ATTR_NAME];
- if (!cur) {
- avl_for_each_element_safe(&services, s, avl, tmp)
- service_delete(s);
- return 0;
- }
+ if (!cur)
+ return UBUS_STATUS_NOT_FOUND;
s = avl_find_element(&services, blobmsg_data(cur), s, avl);
if (!s)