display: check replied return of dbus method call 34/270634/1 submit/tizen/20220208.052553 submit/tizen/20220208.075544 submit/tizen/20220222.024249
authorYoungjae Cho <y0.cho@samsung.com>
Mon, 7 Feb 2022 06:34:07 +0000 (15:34 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Mon, 7 Feb 2022 06:35:15 +0000 (15:35 +0900)
Change-Id: I3a33463fa4187bb21854321849113f9b1b2edc2d
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
src/display.c

index 033f950..e8e25c8 100644 (file)
@@ -162,6 +162,7 @@ int device_display_get_brightness(int display_index, int *brightness)
 int device_display_set_brightness(int display_index, int brightness)
 {
        int ret_val, max;
+       int ret_dbus;
 
        ret_val = is_feature_display_supported();
        if (!ret_val)
@@ -182,10 +183,14 @@ int device_display_set_brightness(int display_index, int brightness)
        if (brightness < 0 || brightness > display_arr[display_index].normal_max)
                return DEVICE_ERROR_INVALID_PARAMETER;
 
-       ret_val = gdbus_call_sync_with_reply_int(DEVICED_BUS_NAME,
+       ret_dbus = gdbus_call_sync_with_reply_int(DEVICED_BUS_NAME,
                        DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY,
                        METHOD_SET_BRIGHTNESS, g_variant_new("(ii)", (int)DISPLAY_STATE_NORMAL, brightness),
-                       NULL);
+                       &ret_val);
+
+       if (ret_dbus < 0)
+               return DEVICE_ERROR_OPERATION_FAILED;
+
        if (ret_val < 0)
                return errno_to_device_error(ret_val); //LCOV_EXCL_LINE System Error