summaryrefslogtreecommitdiff
path: root/src/decision_makers/unit_control_dm.c
diff options
context:
space:
mode:
authorMaciej Slodczyk <m.slodczyk2@partner.samsung.com>2019-05-17 17:31:19 +0200
committerMaciej Slodczyk <m.slodczyk2@partner.samsung.com>2019-06-06 17:58:55 +0200
commit51d46e2f6f6871b5a68328fc08ae65b99d47e425 (patch)
treefd5fb2436688df32ba02ad51d2439cd5cb44546b /src/decision_makers/unit_control_dm.c
parent6e1a36e534b3ed90c915b6136cd1db6453587d73 (diff)
downloadactivationd-51d46e2f6f6871b5a68328fc08ae65b99d47e425.tar.gz
activationd-51d46e2f6f6871b5a68328fc08ae65b99d47e425.tar.bz2
activationd-51d46e2f6f6871b5a68328fc08ae65b99d47e425.zip
unit control: fix async dbus method calls results reporting
Change-Id: I09326b17bf1eb05a933f0e13b46600f61a715199 Signed-off-by: Maciej Slodczyk <m.slodczyk2@partner.samsung.com>
Diffstat (limited to 'src/decision_makers/unit_control_dm.c')
-rw-r--r--src/decision_makers/unit_control_dm.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/decision_makers/unit_control_dm.c b/src/decision_makers/unit_control_dm.c
index fcf6406..4e0f199 100644
--- a/src/decision_makers/unit_control_dm.c
+++ b/src/decision_makers/unit_control_dm.c
@@ -229,6 +229,7 @@ static int unit_control_execute(const char *unit, const char *command, struct ep
};
struct epc_event *new_ev;
int ret;
+ struct unit_control_event *event = to_unit_control_event(ev);
ev_data.action = EPC_ACTION_UNIT_START_ID;
ret = epc_object_new(&ev_data.action_data);
@@ -261,9 +262,15 @@ static int unit_control_execute(const char *unit, const char *command, struct ep
goto out;
}
+ epc_event_ref(&event->event);
+ event->jobs_cnt++;
+
ret = event_processor_report_event(new_ev);
epc_event_unref(new_ev);
+
if (ret) {
+ event->jobs_cnt--;
+ epc_event_unref(&event->event);
log_error_errno(ret, "unable to report event - %m");
goto out;
}
@@ -355,7 +362,7 @@ static int match_unit(const char *unit_name, const char *unit_whitelist_rule)
*
* User needs to free returned pointer.
* */
-char *construct_proper_service_name(char *requested_name, char *whitelist_name)
+static char *construct_proper_service_name(char *requested_name, char *whitelist_name)
{
assert(requested_name);
assert(whitelist_name);
@@ -437,10 +444,11 @@ cleanup:
if (error_code != 0) {
sd_bus_error_set_errno(&error, error_code);
ret = sd_bus_reply_method_error(ev->m, &error);
+ sd_bus_message_unref(ev->m);
+ ret = error_code;
} else {
- ret = sd_bus_reply_method_return(ev->m, "s", "ok");
+ ret = 0;
}
- sd_bus_message_unref(ev->m);
epc_event_unref(event);
return ret;
}