tools: devicectl: add handling code to return check
[platform/core/system/deviced.git] / tools / devicectl / devicectl.c
index 456cd42..be8f063 100644 (file)
@@ -417,25 +417,37 @@ out:
 
 static int power_suspend(char **args)
 {
-       gdbus_call_sync_with_reply(DEVICED_BUS_NAME,
+       int ret;
+       ret = gdbus_call_sync_with_reply(DEVICED_BUS_NAME,
                DEVICED_PATH_POWER,
                DEVICED_INTERFACE_POWER,
                "PowerChangeStateWithReason",
                g_variant_new("(ti)", DEVICED_POWER_STATE_SLEEP, atoi(args[3])),
                NULL);
 
+       if (ret < 0) {
+               _E("Failed to call dbus method PowerChangeStateWithReason");
+               return ret;
+       }
+
        return 0;
 }
 
 static int power_resume(char **args)
 {
-       gdbus_call_sync_with_reply(DEVICED_BUS_NAME,
+       int ret;
+       ret = gdbus_call_sync_with_reply(DEVICED_BUS_NAME,
                DEVICED_PATH_POWER,
                DEVICED_INTERFACE_POWER,
                "PowerChangeStateWithReason",
                g_variant_new("(ti)", DEVICED_POWER_STATE_NORMAL, atoi(args[3])),
                NULL);
 
+       if (ret < 0) {
+               _E("Failed to call dbus method PowerChangeStateWithReason");
+               return ret;
+       }
+
        return 0;
 }