summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bluetooth-otp.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/bluetooth-otp.c b/src/bluetooth-otp.c
index 8f1f30d..7a5328a 100644
--- a/src/bluetooth-otp.c
+++ b/src/bluetooth-otp.c
@@ -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;
}