libubus: fix ubus_invoke() to return err in case ubus_start_request() fails

Seems the UBUS_MAX_MSGLEN is ignored by ubus_invoke(),
and then segfault happens.

This issue is present before this set of patches.
This commit is contained in:
Alexandru Ardelean 2014-06-27 19:11:44 +03:00 committed by Felix Fietkau
parent 996e16b2cb
commit f47005a44c

View file

@ -224,8 +224,12 @@ int ubus_invoke(struct ubus_context *ctx, uint32_t obj, const char *method,
int timeout)
{
struct ubus_request req;
int rc;
rc = ubus_invoke_async(ctx, obj, method, msg, &req);
if (rc)
return rc;
ubus_invoke_async(ctx, obj, method, msg, &req);
req.data_cb = cb;
req.priv = priv;
return ubus_complete_request(ctx, &req, timeout);