projects
/
project
/
ubus.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
libubus: nullify stale msgbuf pointer in case of ubus_connect_ctx() failure
[project/ubus.git]
/
libubus-req.c
diff --git
a/libubus-req.c
b/libubus-req.c
index
ebc5806
..
416adab
100644
(file)
--- a/
libubus-req.c
+++ b/
libubus-req.c
@@
-153,12
+153,17
@@
int ubus_complete_request(struct ubus_context *ctx, struct ubus_request *req,
timeout = time_end - get_time_msec();
if (timeout <= 0) {
ubus_set_req_status(req, UBUS_STATUS_TIMEOUT);
timeout = time_end - get_time_msec();
if (timeout <= 0) {
ubus_set_req_status(req, UBUS_STATUS_TIMEOUT);
+ uloop_cancelled = cancelled;
break;
}
}
ubus_poll_data(ctx, (unsigned int) timeout);
uloop_cancelled = cancelled;
break;
}
}
ubus_poll_data(ctx, (unsigned int) timeout);
uloop_cancelled = cancelled;
+ if (ctx->sock.eof) {
+ ubus_set_req_status(req, UBUS_STATUS_CONNECTION_FAILED);
+ break;
+ }
}
ctx->stack_depth--;
if (ctx->stack_depth)
}
ctx->stack_depth--;
if (ctx->stack_depth)
@@
-174,7
+179,7
@@
int ubus_complete_request(struct ubus_context *ctx, struct ubus_request *req,
if (!registered) {
uloop_fd_delete(&ctx->sock);
if (!registered) {
uloop_fd_delete(&ctx->sock);
- if (ctx->stack_depth)
+ if (
!
ctx->stack_depth)
ctx->pending_timer.cb(&ctx->pending_timer);
}
ctx->pending_timer.cb(&ctx->pending_timer);
}
@@
-465,3
+470,9
@@
void __hidden ubus_process_req_msg(struct ubus_context *ctx, struct ubus_msghdr_
break;
}
}
break;
}
}
+
+int __ubus_monitor(struct ubus_context *ctx, const char *type)
+{
+ blob_buf_init(&b, 0);
+ return ubus_invoke(ctx, UBUS_SYSTEM_OBJECT_MONITOR, type, b.head, NULL, NULL, 1000);
+}