SVACE Fixes 15/149515/1 accepted/tizen/4.0/unified/20170915.201249 submit/tizen_4.0/20170914.075053
authorAnupam Roy <anupam.r@samsung.com>
Mon, 11 Sep 2017 12:38:20 +0000 (18:08 +0530)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 12 Sep 2017 10:34:59 +0000 (19:34 +0900)
ID's: 252909, 258247, 258248, 258249

Change-Id: I563ecfbec21f9b44799a45c38cee13359d7a1fd3
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
src/bluetooth-otp.c

index 8f1f30d7a36f6fb1702e4463a0db6d3131748759..7a5328a61fff03d1d7cf84e3bef20e186ef044b9 100644 (file)
@@ -1838,6 +1838,7 @@ static gboolean __client_data_received_cb(GIOChannel *chan, GIOCondition cond,
                object_metadata *object_info = NULL;
                uint64_t obj_id;
                FILE *fp = NULL;
+               char err_msg[256] = {0, };
 
                otp_client_s = _bt_otp_client_find(remote_addr);
                if (otp_client_s == NULL) {
@@ -1859,7 +1860,8 @@ static gboolean __client_data_received_cb(GIOChannel *chan, GIOCondition cond,
 
                fp = fopen(file_path, "w");
                if (!fp) {
-                       BT_DBG("fopen() failed : %s", strerror(errno));
+                       strerror_r(errno, err_msg, sizeof(err_msg));
+                       BT_ERR("fopen() failed : %s", err_msg);
                        goto fail;
                }
 
@@ -1911,6 +1913,7 @@ static void _bt_otp_client_write_on_fd(bluetooth_otc_info_t *otc_info)
        bluetooth_device_address_t addr_hex = { {0,} };
        struct tm fc_tm;
        uint8_t value[7];
+       char err_msg[256] = {0, };
 
        if (!oacp_write_op) {
                result = BLUETOOTH_ERROR_INTERNAL;
@@ -1921,7 +1924,8 @@ static void _bt_otp_client_write_on_fd(bluetooth_otc_info_t *otc_info)
 
        fp = fopen(oacp_write_op->file_path, "r");
        if (!fp) {
-               BT_DBG("fopen() failed : %s", strerror(errno));
+               strerror_r(errno, err_msg, sizeof(err_msg));
+               BT_ERR("fopen() failed : %s", err_msg);
                result = BLUETOOTH_ERROR_INTERNAL;
                goto fail;
        }
@@ -2232,6 +2236,7 @@ int bt_otp_client_create_object(bt_otp_client_h otp_client,
        char *file_name, *last_token;
        time_t curr_time;
        char *type_uuid;
+       char err_msg[256] = {0, };
 
        BT_CHECK_LE_SUPPORT();
        BT_CHECK_INIT_STATUS();
@@ -2260,7 +2265,8 @@ int bt_otp_client_create_object(bt_otp_client_h otp_client,
 
        /* Get file_name & size from file_path */
        if (stat(file_path, &st) == -1) {
-               BT_INFO("stat failed: %s (%d)\n", strerror(errno), errno);
+               strerror_r(errno, err_msg, sizeof(err_msg));
+               BT_INFO("stat failed: %s (%d)\n", err_msg, errno);
                return BLUETOOTH_ERROR_INTERNAL;
        }
 
@@ -2335,6 +2341,7 @@ int bt_otp_client_write_object(bt_otp_client_h otp_client,
        struct stat st;
        uint32_t size;
        time_t curr_time;
+       char err_msg[256] = {0, };
 
        BT_CHECK_LE_SUPPORT();
        BT_CHECK_INIT_STATUS();
@@ -2376,7 +2383,8 @@ int bt_otp_client_write_object(bt_otp_client_h otp_client,
 
        /* Get file_name & size from file_path */
        if (stat(file_path, &st) == -1) {
-               BT_INFO("stat failed: %s (%d)\n", strerror(errno), errno);
+               strerror_r(errno, err_msg, sizeof(err_msg));
+               BT_INFO("stat failed: %s (%d)\n", err_msg, errno);
                return BLUETOOTH_ERROR_INTERNAL;
        }