From 3b82d1514d30db14823849a978d7fab5989f9762 Mon Sep 17 00:00:00 2001 From: Alice Frosi Date: Thu, 16 Feb 2023 13:48:40 +0100 Subject: actions: add reference to a_return The action return can return either a constant value or a reference to a value. Signed-off-by: Alice Frosi --- actions.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'actions.c') diff --git a/actions.c b/actions.c index bb31732..0366916 100644 --- a/actions.c +++ b/actions.c @@ -198,7 +198,15 @@ int do_actions(struct action actions[], unsigned int n_actions, int pid, resp.id = id; resp.flags = 0; resp.error = 0; - resp.val = actions[i].ret.value; + if (actions[i].ret.type == IMMEDIATE) { + resp.val = actions[i].ret.value; + } else if (actions[i].ret.value_p != NULL) { + resp.val = *(actions[i].ret.value_p); + } else { + fprintf(stderr, "empty reference for the return value"); + return -1; + } + if (send_target(&resp, notifyfd) == -1) return -1; break; -- cgit v1.2.3