change strerror to strerror_r
authorJunkyeong Kim <jk0430.kim@samsung.com>
Wed, 21 Nov 2018 08:43:39 +0000 (17:43 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 22 Nov 2018 05:32:08 +0000 (14:32 +0900)
Change-Id: I7db140c006f838e0285dc0407fe53cdc3c1f6b45
Signed-off-by: Junkyeong Kim <jk0430.kim@samsung.com>
src/tdm_sprd_display.c

index b9d57d8..7dea62c 100644 (file)
@@ -20,6 +20,8 @@ typedef struct drm_event hw_event_t;
                (__after)->next->prev = (__item); \
                (__after)->next = (__item);
 
+#define STRERROR_SIZE 128
+
 typedef struct _Drm_Event_Context {
        void (*vblank_handler)(int fd, unsigned int sequence, unsigned int tv_sec,
                                                        unsigned int tv_usec, void *user_data);
@@ -109,10 +111,11 @@ _localdrmWaitVBlank(int fd, drmVBlank *vbl)
 {
        struct timespec timeout = {0, }, cur = {0, };
        int ret;
+       char buf[STRERROR_SIZE];
 
        ret = clock_gettime(CLOCK_MONOTONIC, &timeout);
        if (ret < 0) {
-               TDM_ERR("clock_gettime failed: %s", strerror(errno));
+               TDM_ERR("clock_gettime failed: %s", strerror_r(errno, buf, STRERROR_SIZE));
                goto out;
        }
        timeout.tv_sec++;
@@ -184,12 +187,14 @@ static tdm_error
 _tdm_sprd_display_output_disable(tdm_sprd_output_data *output_data)
 {
        tdm_sprd_layer_data *layer_data = NULL;
+       char buf[STRERROR_SIZE];
+
        LIST_FOR_EACH_ENTRY(layer_data, &output_data->layer_list, link)
                memset(&layer_data->ovi, 0, sizeof(overlay_info));
 
        TDM_DBG("FB_BLANK_POWERDOWN\n");
        if (ioctl(output_data->fb_fd, FBIOBLANK, FB_BLANK_POWERDOWN) < 0) {
-               TDM_ERR("FB_BLANK_POWERDOWN is failed: %s\n", strerror(errno));
+               TDM_ERR("FB_BLANK_POWERDOWN is failed: %s\n", strerror_r(errno, buf, STRERROR_SIZE));
                return TDM_ERROR_OPERATION_FAILED;
        }
        return TDM_ERROR_NONE;
@@ -200,11 +205,13 @@ _tdm_sprd_display_output_enable(tdm_sprd_output_data *output_data)
 {
        TDM_DBG("FB_BLANK_UNBLANK\n");
        tdm_sprd_layer_data *layer_data = NULL;
+       char buf[STRERROR_SIZE];
+
        LIST_FOR_EACH_ENTRY(layer_data, &output_data->layer_list, link) {
                memset(&layer_data->ovi, 0, sizeof(overlay_info));
        }
        if (ioctl(output_data->fb_fd, FBIOBLANK, FB_BLANK_UNBLANK) < 0) {
-               TDM_ERR("FB_BLANK_UNBLANK is failed: %s\n", strerror(errno));
+               TDM_ERR("FB_BLANK_UNBLANK is failed: %s\n", strerror_r(errno, buf, STRERROR_SIZE));
                return TDM_ERROR_OPERATION_FAILED;
        }
        return TDM_ERROR_NONE;
@@ -215,6 +222,8 @@ _tdm_sprd_display_layer_disable(tdm_layer *layer)
 {
        tdm_sprd_layer_data *layer_data = layer;
        int layer_index = 0;
+       char buf[STRERROR_SIZE];
+
        RETURN_VAL_IF_FAIL(layer_data, TDM_ERROR_OPERATION_FAILED);
        if (layer_data->capabilities & TDM_LAYER_CAPABILITY_PRIMARY) {
                layer_index = SPRD_LAYER_OSD;
@@ -227,7 +236,7 @@ _tdm_sprd_display_layer_disable(tdm_layer *layer)
        if (layer_data->enabled_flag) {
                TDM_DBG("SPRD_FB_UNSET_OVERLAY(%d)\n", layer_index);
                if (ioctl(layer_data->output_data->fb_fd, SPRD_FB_UNSET_OVERLAY, &layer_index) == -1)
-                       TDM_ERR("SPRD_FB_UNSET_OVERLAY(%d) error:%s\n", layer_index, strerror(errno));
+                       TDM_ERR("SPRD_FB_UNSET_OVERLAY(%d) error:%s\n", layer_index, strerror_r(errno, buf, STRERROR_SIZE));
 
                memset(&layer_data->ovi, 0, sizeof(overlay_info));
                layer_data->enabled_flag = 0;
@@ -281,6 +290,7 @@ tdm_sprd_output_do_commit(tdm_sprd_output_data *output_data)
        overlay_info ovi = {0};
        overlay_display ov_disp = {0};
        int layer_index = 0;
+       char buf[STRERROR_SIZE];
 
        RETURN_VAL_IF_FAIL(output_data, TDM_ERROR_OPERATION_FAILED);
 #if 0
@@ -336,7 +346,7 @@ tdm_sprd_output_do_commit(tdm_sprd_output_data *output_data)
                                TDM_DBG("SPRD_FB_SET_OVERLAY(%d) rect:%dx%d+%d+%d size:%dx%d\n", ovi.layer_index, ovi.rect.w,
                                                ovi.rect.h, ovi.rect.x, ovi.rect.y, ovi.size.hsize, ovi.size.vsize);
                                if (ioctl(layer_data->output_data->fb_fd, SPRD_FB_SET_OVERLAY, &ovi) == -1) {
-                                       TDM_ERR("SPRD_FB_SET_OVERLAY(%d) error:%s\n", layer_index, strerror(errno));
+                                       TDM_ERR("SPRD_FB_SET_OVERLAY(%d) error:%s\n", layer_index, strerror_r(errno, buf, STRERROR_SIZE));
                                        continue;
                                }
                                memcpy(&layer_data->ovi, &ovi, sizeof(overlay_info));
@@ -361,7 +371,7 @@ tdm_sprd_output_do_commit(tdm_sprd_output_data *output_data)
                TDM_DBG("SPRD_FB_DISPLAY_OVERLAY(%d) osd_handle:%d img_handle:%d\n", ov_disp.layer_index, ov_disp.osd_handle,
                                ov_disp.img_handle);
                if (ioctl(output_data->fb_fd, SPRD_FB_DISPLAY_OVERLAY, &ov_disp) == -1) {
-                       TDM_ERR("SPRD_FB_DISPLAY_OVERLAY(%d) error: %s \n", strerror(errno), ov_disp.layer_index);
+                       TDM_ERR("SPRD_FB_DISPLAY_OVERLAY(%d) error:%s\n", ov_disp.layer_index, strerror_r(errno, buf, STRERROR_SIZE));
                        res = TDM_ERROR_OPERATION_FAILED;
                } else {
                        //save enable layers