From 6ad5dd9567d541ad9403354629f068fa37de32b9 Mon Sep 17 00:00:00 2001
From: Alice Frosi <afrosi@redhat.com>
Date: Tue, 21 Feb 2023 13:15:16 +0100
Subject: actions: set error on act_call

---
 actions.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/actions.c b/actions.c
index 8e740e0..ff8ff93 100644
--- a/actions.c
+++ b/actions.c
@@ -181,10 +181,23 @@ int do_actions(void *data, struct action actions[], unsigned int n_actions, int
 			c.args = &actions[i].call;
 			c.pid = pid;
 			if (do_call(&c) == -1) {
+				resp.error = -1;
+				if (send_target(&resp, notifyfd) == -1)
+					return -1;
+			}
+			if (c.err != 0) {
 				resp.error = c.err;
 				if (send_target(&resp, notifyfd) == -1)
 					return -1;
 			}
+			/*
+			 * The result of the call needs to be save as
+			 * reference
+			 */
+			if (actions[i].call.has_ret) {
+				memcpy(data + actions[i].call.ret_off,
+					   &c.ret, sizeof(c.ret));
+			}
 			break;
 		case A_BLOCK:
 			resp.id = id;
-- 
cgit v1.2.3