summaryrefslogtreecommitdiffhomepage
path: root/lib/ubus.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ubus.c')
-rw-r--r--lib/ubus.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/ubus.c b/lib/ubus.c
index 4766119..e2491ec 100644
--- a/lib/ubus.c
+++ b/lib/ubus.c
@@ -1226,7 +1226,16 @@ uc_ubus_handle_reply_common(struct ubus_context *ctx,
* returned and if reqobj.reply() hasn't been called, immediately
* finish deferred request with UBUS_STATUS_NO_DATA. */
else if (!callctx->replied) {
- ubus_complete_deferred_request(ctx, &callctx->req, UBUS_STATUS_NO_DATA);
+ rv = UBUS_STATUS_NO_DATA;
+
+ if (ucv_type(res) == UC_INTEGER) {
+ rv = (int)ucv_int64_get(res);
+
+ if (rv < 0 || rv > __UBUS_STATUS_LAST)
+ rv = UBUS_STATUS_UNKNOWN_ERROR;
+ }
+
+ ubus_complete_deferred_request(ctx, &callctx->req, rv);
callctx->replied = true;
}