char local_mac[OEM_MACSTR_LEN] = {0, };
char *ptr = NULL;
int res = 0;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
errno = 0;
fd = fopen(file_path, "r");
if (!fd) {
- WDP_LOGE("Failed to open MAC info file [%s] (%s)", file_path, strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDP_LOGE("Failed to open MAC info file [%s] (%s)", file_path, error_buf);
__WDP_LOG_FUNC_EXIT__;
return -1;
}
errno = 0;
ptr = fgets((char *)local_mac, WS_MACSTR_LEN, fd);
if (!ptr) {
- WDP_LOGE("Failed to read file or no data read(%s)", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDP_LOGE("Failed to read file or no data read(%s)", error_buf);
fclose(fd);
__WDP_LOG_FUNC_EXIT__;
return -1;
edata = (wfd_oem_dev_data_s *) g_try_malloc0(sizeof(wfd_oem_dev_data_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return;
}
__ws_mac_compact_to_normal(loc + 1, peer_dev);
__ws_txt_to_mac(peer_dev, event->dev_addr);
- } else if (g_strcmp0(key, "update_indicator")) {
+ } else if (g_strcmp0(key, "update_indicator") == 0) {
- } else if (g_strcmp0(key, "tlvs")) {
+ } else if (g_strcmp0(key, "tlvs") == 0) {
GVariantIter *iter = NULL;
unsigned char service_hex[WS_MAX_SERVICE_LEN];
int byte_length = 0;
}
#endif /* TIZEN_FEATURE_ASP */
-static int _ws_flush()
+static int _ws_flush(void)
{
__WDP_LOG_FUNC_ENTER__;
GDBusConnection *g_dbus = NULL;
return 0;
}
-static int _ws_cancel()
+static int _ws_cancel(void)
{
__WDP_LOG_FUNC_ENTER__;
GDBusConnection *g_dbus = NULL;
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
edata = (wfd_oem_dev_data_s *) g_try_malloc0(sizeof(wfd_oem_dev_data_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
edata = (wfd_oem_dev_data_s *) g_try_malloc0(sizeof(wfd_oem_dev_data_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
edata = (wfd_oem_dev_data_s *) g_try_malloc0(sizeof(wfd_oem_dev_data_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
edata = (wfd_oem_dev_data_s *) g_try_malloc0(sizeof(wfd_oem_dev_data_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
edata = (wfd_oem_dev_data_s *) g_try_malloc0(sizeof(wfd_oem_dev_data_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
edata = (wfd_oem_dev_data_s *) g_try_malloc0(sizeof(wfd_oem_dev_data_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
edata = (wfd_oem_dev_data_s *) g_try_malloc0(sizeof(wfd_oem_dev_data_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
edata = (wfd_oem_asp_prov_s *) g_try_malloc0(sizeof(wfd_oem_asp_prov_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
edata = (wfd_oem_group_data_s*)calloc(1, sizeof(wfd_oem_group_data_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
edata = (wfd_oem_conn_data_s*)calloc(1, sizeof(wfd_oem_conn_data_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
edata = (wfd_oem_conn_data_s *) g_try_malloc0(sizeof(wfd_oem_conn_data_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
edata = (wfd_oem_dev_data_s *) g_try_malloc0(sizeof(wfd_oem_dev_data_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
edata = (wfd_oem_invite_data_s *) g_try_malloc0(sizeof(wfd_oem_invite_data_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
service = (wfd_oem_asp_service_s *) g_try_malloc0(sizeof(wfd_oem_asp_service_s));
if (!service) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
edata = (wfd_oem_asp_prov_s *) g_try_malloc0(sizeof(wfd_oem_asp_prov_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
edata = (wfd_oem_asp_prov_s *) g_try_malloc0(sizeof(wfd_oem_asp_prov_s));
if (!edata) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory for event. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return;
}
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return;
}
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(g_pd->iface_path, 0x0, DBUS_OBJECT_PATH_MAX);
g_object_unref(g_dbus);
+ __WDP_LOG_FUNC_EXIT__;
return 0;
}
int wfd_plugin_load(wfd_oem_ops_s **ops)
{
+ __WDP_LOG_FUNC_ENTER__;
if (!ops) {
WDP_LOGE("Invalid parameter");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
*ops = &supplicant_ops;
+ __WDP_LOG_FUNC_EXIT__;
return 0;
}
if (ioctl(fd, SIOCGIFFLAGS, &ifr) < 0) {
close(fd);
- WDP_LOGE("ioctl error: SIOCGIFFLAGS: %s [ %s ]", strerror(errno), if_name); /* interface is not found. */
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDP_LOGE("ioctl error: SIOCGIFFLAGS: %s [ %s ]", error_buf, if_name); /* interface is not found. */
return -3;
}
errno = 0;
g_pd = (ws_dbus_plugin_data_s*) g_try_malloc0(sizeof(ws_dbus_plugin_data_s));
if (!g_pd) {
- WDP_LOGE("Failed to allocate memory for plugin data. [%s]", strerror(errno));
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDP_LOGE("Failed to allocate memory for plugin data. [%s]", error_buf);
return -1;
}
int rv = 0;
errno = 0;
register unsigned int index = 0;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
while (args[index] != NULL) {
WDP_LOGD("[%s]", args[index]);
errno = 0;
if (execve(file_path, args, envs) == -1) {
- WDP_LOGE("Fail to execute command (%s)", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDP_LOGE("Fail to execute command (%s)", error_buf);
exit(1);
}
} else if (pid > 0) {
return TRUE;
}
- WDP_LOGE("failed to fork (%s)", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDP_LOGE("failed to fork (%s)", error_buf);
return FALSE;
}
}
#endif
-int __ws_init_p2pdevice()
+int __ws_init_p2pdevice(void)
{
__WDP_LOG_FUNC_ENTER__;
GDBusConnection *g_dbus = NULL;
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
return res;
}
-int __ws_set_config_methods()
+int __ws_set_config_methods(void)
{
__WDP_LOG_FUNC_ENTER__;
GDBusConnection *g_dbus = NULL;
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
if (!g_pd->activated) {
WDP_LOGE("Wi-Fi Direct is not activated");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
}
#endif /* TIZEN_FEATURE_ASP */
-
int ws_start_scan(wfd_oem_scan_param_s *param)
{
__WDP_LOG_FUNC_ENTER__;
if (!param) {
WDP_LOGE("Invalid parameter");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
return res;
}
-int ws_stop_scan()
+int ws_stop_scan(void)
{
__WDP_LOG_FUNC_ENTER__;
GDBusConnection *g_dbus = NULL;
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
if (!peer_addr || !peer) {
WDP_LOGE("Invalid parameter");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
ws_dev = (wfd_oem_device_s *) g_try_malloc0(sizeof(wfd_oem_device_s));
if (!ws_dev) {
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
WDP_LOGF("Failed to allocate memory device. [%s]",
- strerror(errno));
+ error_buf);
__WDP_LOG_FUNC_EXIT__;
return -1;
}
if (!peer_addr) {
WDP_LOGE("Invalid parameter");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
return 0;
}
-int ws_get_supported_wps_mode()
+int ws_get_supported_wps_mode(int *wps_mode)
{
__WDP_LOG_FUNC_ENTER__;
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
return 0;
}
-int ws_wps_cancel()
+int ws_wps_cancel(void)
{
__WDP_LOG_FUNC_ENTER__;
GDBusConnection *g_dbus = NULL;
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
if (!dev_name) {
WDP_LOGE("Invalid parameter");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
if (!g_pd) {
WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
g_dbus = g_pd->g_dbus;
if (!g_dbus) {
WDP_LOGE("DBus connection is NULL");
+ __WDP_LOG_FUNC_EXIT__;
return -1;
}
memset(¶ms, 0x0, sizeof(dbus_method_param_s));
}
#endif /* TIZEN_FEATURE_WIFI_DISPLAY */
-int ws_refresh()
+int ws_refresh(void)
{
__WDP_LOG_FUNC_ENTER__;
__WDS_LOG_FUNC_ENTER__;
wfd_device_s *local = NULL;
int res = 0;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
if (!manager) {
WDS_LOGE("Invalid parameter");
errno = 0;
local = (wfd_device_s*) g_try_malloc0(sizeof(wfd_device_s));
if (!local) {
- WDS_LOGE("Failed to allocate memory for local device [%s]", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to allocate memory for local device [%s]", error_buf);
return -1;
}
wfd_discovery_entry_s *peer_info;
wfd_oem_device_s *oem_dev = NULL;
int res = 0;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
if (!manager || !addr) {
WDS_LOGE("Invalid parameter");
if (!peer_dev) {
peer_dev = (wfd_device_s*) g_try_malloc0(sizeof(wfd_device_s));
if (!peer_dev) {
- WDS_LOGE("Failed to allocate memory for peer device. [%s]", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to allocate memory for peer device. [%s]", error_buf);
free(oem_dev);
return -1;
}
peer_info = (wfd_discovery_entry_s*) g_try_malloc0(sizeof(wfd_discovery_entry_s));
if (!(peer_info)) {
- WDS_LOGE("Failed to allocate memory for peer data. [%s]", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to allocate memory for peer data. [%s]", error_buf);
return -1;
}
int peer_count = 0;
int count = 0;
int res = 0;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
if (!manager || !peers_data) {
WDS_LOGE("Invalid parameter");
errno = 0;
peers = (wfd_discovery_entry_s*) g_try_malloc0_n(peer_count, sizeof(wfd_discovery_entry_s));
if (!peers) {
- WDS_LOGE("Failed to allocate memory for peer data. [%s]", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to allocate memory for peer data. [%s]", error_buf);
return -1;
}
GList *temp = NULL;
int peer_count = 0;
int count = 0;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
if (!manager || !peers_data) {
WDS_LOGE("Invalid parameter");
errno = 0;
peers = (wfd_connected_peer_info_s*) g_try_malloc0_n(peer_count, sizeof(wfd_connected_peer_info_s));
if (!peers) {
- WDS_LOGE("Failed to allocate memory for connected peer data. [%s]", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to allocate memory for connected peer data. [%s]", error_buf);
return -1;
}
wfd_oem_scan_param_s param;
memset(¶m, 0x0, sizeof(wfd_oem_scan_param_s));
- WDS_LOGI("Mode: [%d], Timeout: [%d], type: [%s]", mode, timeout, type, channel);
+ WDS_LOGI("Mode: [%d], Timeout: [%d], type: [%s], channel: [%d]", mode, timeout, type, channel);
if (manager->local->dev_role == WFD_DEV_ROLE_GO)
param.scan_type = WFD_OEM_SCAN_TYPE_SOCIAL;
void *handle;
struct utsname kernel_info;
int res;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
if (!manager) {
WDS_LOGE("Invalid parameter");
int (*plugin_load)(wfd_oem_ops_s **ops) = NULL;
plugin_load = (int (*)(wfd_oem_ops_s **ops)) dlsym(handle, "wfd_plugin_load");
if (!plugin_load) {
- WDS_LOGE("Failed to load symbol. Error = [%s]", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to load symbol. Error = [%s]", error_buf);
dlclose(handle);
__WDS_LOG_FUNC_EXIT__;
return NULL;
{
struct timespec time;
int res;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
errno = 0;
res = clock_gettime(CLOCK_REALTIME, &time);
*cur_time = time.tv_sec;
return 0;
}
- WDS_LOGE("Failed to get current real time(%s)", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to get current real time(%s)", error_buf);
errno = 0;
res = clock_gettime(CLOCK_MONOTONIC, &time);
*cur_time = time.tv_sec;
return 0;
}
- WDS_LOGE("Failed to get current system time(%s)", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to get current system time(%s)", error_buf);
return -1;
}
int rv = 0;
errno = 0;
register unsigned int index = 0;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
while (args[index] != NULL) {
WDS_LOGD("[%s]", args[index]);
errno = 0;
if (execve(file_path, args, envs) == -1) {
- WDS_LOGE("Fail to execute command (%s)", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Fail to execute command (%s)", error_buf);
exit(1);
}
} else if (pid > 0) {
return TRUE;
}
- WDS_LOGE("failed to fork (%s)", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("failed to fork (%s)", error_buf);
return FALSE;
}
char local_mac[MACSTR_LEN] = {0, };
char *ptr = NULL;
int res = 0;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
errno = 0;
fd = fopen(file_path, "r");
if (!fd) {
- WDS_LOGE("Failed to open MAC info file [%s] (%s)", file_path , strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to open MAC info file [%s] (%s)", file_path , error_buf);
__WDS_LOG_FUNC_EXIT__;
return -1;
}
errno = 0;
ptr = fgets(local_mac, MACSTR_LEN, fd);
if (!ptr) {
- WDS_LOGE("Failed to read file or no data read(%s)", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to read file or no data read(%s)", error_buf);
fclose(fd);
__WDS_LOG_FUNC_EXIT__;
return -1;
int flags;
int res = 0;
struct sockaddr_in remo_addr;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
errno = 0;
sock = socket(PF_INET, SOCK_STREAM, 0);
if (sock == -1) {
- WDS_LOGE("Failed to create socket to remote device(%s)", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to create socket to remote device(%s)", error_buf);
return -1;
}
errno = 0;
res = connect(sock, (struct sockaddr*) &remo_addr, sizeof(remo_addr));
if (res < 0) {
- WDS_LOGE("Failed to connect to server socket [%s]", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to connect to server socket [%s]", error_buf);
close(sock);
__WDS_LOG_FUNC_EXIT__;
return -1;
}
- WDS_SECLOGD("Status of connection to remote device[%s] - (%s)", ip_str, strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_SECLOGD("Status of connection to remote device[%s] - (%s)", ip_str, error_buf);
close(sock);
char peer_mac_address[MACSTR_LEN+1] = {0,};
char assigned_ip_address[IPSTR_LEN+1] = {0,};
int n = 0;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
if (!peer) {
WDS_LOGD("Invalid parameter");
errno = 0;
fp = fopen(DHCP_DUMP_FILE, "r");
if (NULL == fp) {
- WDS_LOGE("Could not read the file(%s). [%s]", DHCP_DUMP_FILE, strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Could not read the file(%s). [%s]", DHCP_DUMP_FILE, error_buf);
return;
}
char *ip_str = NULL;
int sock = -1;
int res = -1;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
if (!ifname || !ip_addr) {
WDS_LOGE("Invalid parameter");
errno = 0;
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < SOCK_FD_MIN) {
- WDS_LOGE("Failed to create socket. [%s]", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to create socket. [%s]", error_buf);
if (sock >= 0)
close(sock);
__WDS_LOG_FUNC_EXIT__;
errno = 0;
res = ioctl(sock, SIOCGIFADDR, &ifr);
if (res < 0) {
- WDS_LOGE("Failed to get IP from socket. [%s]", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to get IP from socket. [%s]", error_buf);
close(sock);
__WDS_LOG_FUNC_EXIT__;
return -1;
struct iovec iov;
struct msghdr nl_msg;
+ char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
+
if (!ifname || !static_ip) {
WDS_LOGE("Invalid parameter");
__WDS_LOG_FUNC_EXIT__;
/* Get index of interface */
if_index = if_nametoindex(ifname);
if (if_index < 0) {
- WDS_LOGE("Failed to get interface index. [%s]", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to get interface index. [%s]", error_buf);
__WDS_LOG_FUNC_EXIT__;
return -1;
}
WDS_LOGD("Creating a Netlink Socket");
nl_sock = socket(AF_NETLINK, SOCK_RAW, NETLINK_ROUTE);
if (nl_sock < 0) {
- WDS_LOGE("Failed to create socket. [%s]", strerror(errno));
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to create socket. [%s]", error_buf);
__WDS_LOG_FUNC_EXIT__;
return -1;
}
nl_msg.msg_iovlen = 1;
res = sendmsg(nl_sock, &nl_msg, 0);
- if (res < 0)
- WDS_LOGE("Failed to sendmsg. [%s]", strerror(errno));
- else
+ if (res < 0) {
+ strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+ WDS_LOGE("Failed to sendmsg. [%s]", error_buf);
+ } else {
WDS_LOGD("Succed to sendmsg. [%d]", res);
+ }
close(nl_sock);
WDS_LOGE("Succeeded to set local(client) IP [" IPSTR "] for iface[%s]",