Use more of the available information in some error cases 05/214605/1
authorMichal Bloch <m.bloch@samsung.com>
Tue, 24 Sep 2019 12:01:38 +0000 (14:01 +0200)
committerMichal Bloch <m.bloch@samsung.com>
Tue, 24 Sep 2019 12:06:42 +0000 (14:06 +0200)
Change-Id: I0806e577936f1ca2e1156521b6f1029986f88394
Signed-off-by: Michal Bloch <m.bloch@samsung.com>
src/action/service_restart.c
src/action/unit_start.c

index f4635923ac1a628149ced2f68644a171824f6743..899f835f6eccb7c751207fb355756ed26204c7c0 100644 (file)
@@ -39,10 +39,10 @@ static int restart_service(struct epc_action *action,
 
        ret = epc_object_get_string(dm_ev->action_data,
                                                                   EPC_AD_SERVICE_NAME, &service_path);
-       if (!service_path) {
+       if (ret < 0 || !service_path) {
                epc_object_append_string(exe_info->action_log, "error",
                                                                        "Service path has not been provided");
-               exe_info->result = -EINVAL;
+               exe_info->result = ret < 0 ? ret : -EINVAL;
                return 0;
        }
 
index d65acd1b878084840a02036e59b941be87e82d3d..10343236d05def3ce209fa8f49211fac084d3d73 100644 (file)
@@ -128,10 +128,10 @@ static int start_unit(struct epc_action *action,
 
        ret = epc_object_get_string(dm_ev->action_data,
                        EPC_AD_UNIT_NAME, &unit_name);
-       if (!unit_name) {
+       if (ret < 0 || !unit_name) {
                epc_object_append_string(exe_info->action_log, "error",
                                "Unit name not specified");
-               exe_info->result = -EINVAL;
+               exe_info->result = ret < 0 ? ret : -EINVAL;
                return 0;
        }
 
@@ -147,8 +147,8 @@ static int start_unit(struct epc_action *action,
 
        ret = epc_object_get_string(dm_ev->action_data,
                        EPC_AD_UNIT_ACTION, &unit_action);
-       if (!unit_action)
-               return finish_action(data, -EINVAL, "Unit action not specified");
+       if (ret < 0 || !unit_action)
+               return finish_action(data, ret < 0 ? ret : -EINVAL, "Unit action not specified");
 
        if (strcmp(unit_action, "StartUnit") &&
                        strcmp(unit_action, "StopUnit") &&