libubus: fix synchronous ubus_notify without waiting for a timeout
[project/ubus.git] / libubus-req.c
index 4d0adb6..f02af8e 100644 (file)
@@ -285,8 +285,10 @@ int ubus_notify(struct ubus_context *ctx, struct ubus_object *obj,
        if (ret < 0)
                return ret;
 
-       if (timeout < 0)
+       if (timeout < 0) {
+               ubus_abort_request(ctx, &req.req);
                return 0;
+       }
 
        return ubus_complete_request(ctx, &req.req, timeout);
 }
@@ -392,7 +394,7 @@ static void ubus_process_notify_status(struct ubus_request *req, int id, struct
        struct blob_attr **tb;
        struct blob_attr *cur;
        int rem, idx = 1;
-       int ret;
+       int ret = 0;
 
        nreq = container_of(req, struct ubus_notify_request, req);
        nreq->pending &= ~(1 << id);