summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2018-11-28 12:12:04 +0100
committerJo-Philipp Wich <jo@mein.io>2018-11-28 12:12:04 +0100
commit3aa81d0dfae167eccc26203bd0c96f3e3450f253 (patch)
treeca5f72bf6883e97c16a9745ca95e5cad910be12e
parent7235f348958969d8aa0bfffd167acd3cd161efd0 (diff)
downloadrpcd-3aa81d0dfae167eccc26203bd0c96f3e3450f253.tar.gz
file: access exec timeout via daemon ops structure
Since the plugin is not linked, but dlopen()'d with RTLD_LOCAL, we cannot access global rpcd variables but need to access them via the common ops structure symbol. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
-rw-r--r--file.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/file.c b/file.c
index e1bc0ac..4882598 100644
--- a/file.c
+++ b/file.c
@@ -53,6 +53,8 @@
us.stream.notify_state = rpc_file_##name##_state_cb; \
ustream_fd_init(&us, fd);
+static const struct rpc_daemon_ops *ops;
+
struct rpc_file_exec_context {
struct ubus_context *context;
struct ubus_request_data request;
@@ -690,7 +692,7 @@ rpc_file_exec_run(const char *cmd,
uloop_process_add(&c->process);
c->timeout.cb = rpc_file_exec_timeout_cb;
- uloop_timeout_set(&c->timeout, rpc_exec_timeout);
+ uloop_timeout_set(&c->timeout, *ops->exec_timeout);
close(opipe[1]);
close(epipe[1]);
@@ -742,6 +744,8 @@ rpc_file_api_init(const struct rpc_daemon_ops *o, struct ubus_context *ctx)
.n_methods = ARRAY_SIZE(file_methods),
};
+ ops = o;
+
return ubus_add_object(ctx, &obj);
}