Bug Fix and Code Cleanup 06/125806/2
authorMilind Ramesh Murhekar <m.murhekar@samsung.com>
Wed, 19 Apr 2017 03:46:31 +0000 (09:16 +0530)
committerMilind Ramesh Murhekar <m.murhekar@samsung.com>
Wed, 19 Apr 2017 08:47:17 +0000 (14:17 +0530)
Description: This change includes the
VD tizen 3.0 product changes which merged as a bug fixses
and code clean up

Change-Id: I04dffe55037477fee0c649269504aab64fffa555
Signed-off-by: Milind Ramesh Murhekar <m.murhekar@samsung.com>
include/wifi-direct-util.h
oem/wifi-direct-oem.h
packaging/wifi-direct-manager.spec
plugin/wpasupplicant/ctrl_iface_dbus/include/wfd-plugin-wpasupplicant.h
plugin/wpasupplicant/ctrl_iface_dbus/wfd-plugin-wpasupplicant.c
src/wifi-direct-group.c
src/wifi-direct-manager.c
src/wifi-direct-util.c

index 3cf39bb..d1286bc 100644 (file)
@@ -39,6 +39,7 @@
 #define MACSECSTR "%02x:%02x:%02x"
 #define IP2SECSTR(a) (a)[0], (a)[3]
 #define IPSECSTR "%d..%d"
+#define MAX_SIZE_ERROR_BUFFER 256
 
 #define DHCP_DUMP_FILE "/tmp/dhcp-client-table"
 #define MAX_DHCP_DUMP_SIZE 64    /* Single lease format: [99:66:dd:00:11:aa 192.168.16.20 00:00:60] */
index 01e4ed5..052a67d 100644 (file)
@@ -549,7 +549,7 @@ typedef struct {
        int auth_alg;
        int mode;
        int p2p_client_num;
-       unsigned char p2p_client_list[OEM_MACADDR_LEN][OEM_MAX_PEER_NUM];
+       unsigned char p2p_client_list[OEM_MAX_PEER_NUM][OEM_MACADDR_LEN];
 } wfd_oem_persistent_group_s;
 
 typedef struct {
index 8d751e3..8bec370 100644 (file)
@@ -8,7 +8,7 @@
 
 Name:          wifi-direct-manager
 Summary:       Wi-Fi Direct manger
-Version:       1.2.220
+Version:       1.2.221
 Release:       1
 Group:      Network & Connectivity/Wireless
 License:    Apache-2.0
index 49ab39a..185a0b1 100644 (file)
@@ -39,6 +39,7 @@
 #define IP2SECSTR(a) (a)[0], (a)[3]
 #define IPSECSTR "%d..%d"
 #define OBJECT_PATH_MAX 150
+#define MAX_SIZE_ERROR_BUFFER 256
 
 #if defined(TIZEN_PROFILE_MOBILE) || defined(TIZEN_PROFILE_COMMON)
 #define COMMON_IFACE_NAME "wlan0"
@@ -399,7 +400,7 @@ int ws_activate(int concurrent);
 int ws_deactivate(int concurrent);
 int ws_start_scan(wfd_oem_scan_param_s *param);
 int ws_restart_scan(int freq);
-int ws_stop_scan();
+int ws_stop_scan(void);
 int ws_get_visibility(int *visibility);
 int ws_set_visibility(int visibility);
 int ws_get_scan_result(GList **peers, int *peer_count);
@@ -413,13 +414,13 @@ int ws_get_connected_peers(GList **peers, int *peer_count);
 int ws_get_pin(char *pin);
 int ws_set_pin(char *pin);
 int ws_generate_pin(char **pin);
-int ws_get_supported_wps_mode();
+int ws_get_supported_wps_mode(int *wps_mode);
 int ws_create_group(wfd_oem_group_param_s *param);
 int ws_destroy_group(const char *ifname);
 int ws_invite(unsigned char *peer_addr, wfd_oem_invite_param_s *param);
 int ws_wps_start(unsigned char *peer_addr, int wps_mode, const char *pin);
 int ws_enrollee_start(unsigned char *peer_addr, int wps_mode, const char *pin);
-int ws_wps_cancel();
+int ws_wps_cancel(void);
 int ws_get_dev_name(char *dev_name);
 int ws_set_dev_name(char *dev_name);
 int ws_get_dev_mac(char *dev_mac);
@@ -446,7 +447,7 @@ int ws_miracast_init(int enable);
 int ws_set_display(wfd_oem_display_s *wifi_display);
 #endif /* TIZEN_FEATURE_WIFI_DISPLAY */
 
-int ws_refresh();
+int ws_refresh(void);
 int ws_save_config(void);
 int ws_set_operating_channel(int channel);
 int ws_remove_all_network(void);
index 2431281..abda0fa 100755 (executable)
@@ -472,11 +472,13 @@ static int _ws_get_local_dev_mac(unsigned char *dev_mac)
        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;
        }
@@ -484,7 +486,8 @@ static int _ws_get_local_dev_mac(unsigned char *dev_mac)
        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;
@@ -949,8 +952,10 @@ static void _ws_process_peer_joined(GDBusConnection *connection,
 
        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;
        }
@@ -1041,6 +1046,7 @@ void __ws_extract_group_details(const char *key, GVariant *value, void *user_dat
 
        if (!g_pd) {
                WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+               __WDP_LOG_FUNC_EXIT__;
                return;
        }
 
@@ -1268,9 +1274,9 @@ void __ws_extract_servicediscoveryresponse_details(const char *key, GVariant *va
                        __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;
@@ -1542,7 +1548,7 @@ static void __ws_extract_provision_fail_details(const char *key, GVariant *value
 }
 #endif /* TIZEN_FEATURE_ASP */
 
-static int _ws_flush()
+static int _ws_flush(void)
 {
        __WDP_LOG_FUNC_ENTER__;
        GDBusConnection *g_dbus = NULL;
@@ -1576,7 +1582,7 @@ static int _ws_flush()
        return 0;
 }
 
-static int _ws_cancel()
+static int _ws_cancel(void)
 {
        __WDP_LOG_FUNC_ENTER__;
        GDBusConnection *g_dbus = NULL;
@@ -1585,6 +1591,7 @@ static int _ws_cancel()
 
        if (!g_pd) {
                WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+               __WDP_LOG_FUNC_EXIT__;
                return -1;
        }
 
@@ -1592,6 +1599,7 @@ static int _ws_cancel()
        g_dbus = g_pd->g_dbus;
        if (!g_dbus) {
                WDP_LOGE("DBus connection is NULL");
+               __WDP_LOG_FUNC_EXIT__;
                return -1;
        }
        memset(&params, 0x0, sizeof(dbus_method_param_s));
@@ -1960,8 +1968,10 @@ static void _ws_process_device_found_properties(GDBusConnection *connection,
 
        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;
        }
@@ -2110,8 +2120,10 @@ static void _ws_process_prov_disc_req_display_pin(GDBusConnection *connection,
 
        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;
        }
@@ -2169,8 +2181,10 @@ static void _ws_process_prov_disc_resp_display_pin(GDBusConnection *connection,
 
        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;
        }
@@ -2224,8 +2238,10 @@ static void _ws_process_prov_disc_req_enter_pin(GDBusConnection *connection,
 
        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;
        }
@@ -2268,8 +2284,10 @@ static void _ws_process_prov_disc_resp_enter_pin(GDBusConnection *connection,
 
        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;
        }
@@ -2312,8 +2330,10 @@ static void _ws_process_prov_disc_pbc_req(GDBusConnection *connection,
 
        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;
        }
@@ -2356,8 +2376,10 @@ static void _ws_process_prov_disc_pbc_resp(GDBusConnection *connection,
 
        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;
        }
@@ -2401,8 +2423,10 @@ static void _ws_process_prov_disc_failure(GDBusConnection *connection,
 
        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;
        }
@@ -2495,8 +2519,10 @@ static void _ws_process_group_started(GDBusConnection *connection,
 
        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;
        }
@@ -2544,8 +2570,10 @@ static void _ws_process_go_neg_success(GDBusConnection *connection,
 
        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;
        }
@@ -2593,8 +2621,10 @@ static void _ws_process_go_neg_failure(GDBusConnection *connection,
 
        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;
        }
@@ -2647,8 +2677,10 @@ static void _ws_process_go_neg_request(GDBusConnection *connection,
 
        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;
        }
@@ -2710,8 +2742,10 @@ static void _ws_process_invitation_received(GDBusConnection *connection,
 
        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;
        }
@@ -2858,8 +2892,10 @@ static void _ws_process_service_asp_response(GDBusConnection *connection,
 
        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;
        }
@@ -3078,8 +3114,10 @@ static void _ws_process_asp_provision_start(GDBusConnection *connection,
 
        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;
        }
@@ -3128,8 +3166,10 @@ static void _ws_process_asp_provision_done(GDBusConnection *connection,
 
        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;
        }
@@ -3442,6 +3482,7 @@ static void __register_p2pdevice_signal(GVariant *value, void *user_data)
 
        if (!g_pd) {
                WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+               __WDP_LOG_FUNC_EXIT__;
                return;
        }
 
@@ -3497,12 +3538,14 @@ static int _ws_create_interface(const char *iface_name, handle_reply function, v
 
        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(&params, 0x0, sizeof(dbus_method_param_s));
@@ -3533,12 +3576,14 @@ static int _ws_get_interface(const char *iface_name, handle_reply function, void
 
        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;
        }
 
@@ -3611,6 +3656,7 @@ static int _ws_init_dbus_connection(void)
 
        if (!g_pd) {
                WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+               __WDP_LOG_FUNC_EXIT__;
                return -1;
        }
 
@@ -3675,6 +3721,7 @@ static int _ws_deinit_dbus_connection(void)
        g_dbus = g_pd->g_dbus;
        if (!g_dbus) {
                WDP_LOGE("DBus connection is NULL");
+               __WDP_LOG_FUNC_EXIT__;
                return -1;
        }
 
@@ -3702,18 +3749,22 @@ static int _ws_deinit_dbus_connection(void)
        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;
 }
 
@@ -3761,7 +3812,9 @@ static int __ws_check_net_interface(char* if_name)
 
        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;
        }
 
@@ -3793,7 +3846,9 @@ int ws_init(wfd_oem_event_cbs_s *event_cbs)
        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;
        }
 
@@ -3824,6 +3879,7 @@ gboolean _ws_util_execute_file(const char *file_path,
        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]);
@@ -3836,7 +3892,8 @@ gboolean _ws_util_execute_file(const char *file_path,
 
                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) {
@@ -3854,7 +3911,8 @@ gboolean _ws_util_execute_file(const char *file_path,
                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;
 }
 
@@ -4021,7 +4079,7 @@ static int __ws_p2p_off(void)
 }
 #endif
 
-int __ws_init_p2pdevice()
+int __ws_init_p2pdevice(void)
 {
        __WDP_LOG_FUNC_ENTER__;
        GDBusConnection *g_dbus = NULL;
@@ -4045,6 +4103,7 @@ int __ws_init_p2pdevice()
 
        if (!g_pd) {
                WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+               __WDP_LOG_FUNC_EXIT__;
                return -1;
        }
 
@@ -4054,6 +4113,7 @@ int __ws_init_p2pdevice()
        g_dbus = g_pd->g_dbus;
        if (!g_dbus) {
                WDP_LOGE("DBus connection is NULL");
+               __WDP_LOG_FUNC_EXIT__;
                return -1;
        }
        memset(&params, 0x0, sizeof(dbus_method_param_s));
@@ -4141,7 +4201,7 @@ int __ws_init_p2pdevice()
        return res;
 }
 
-int __ws_set_config_methods()
+int __ws_set_config_methods(void)
 {
        __WDP_LOG_FUNC_ENTER__;
        GDBusConnection *g_dbus = NULL;
@@ -4154,12 +4214,14 @@ int __ws_set_config_methods()
 
        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(&params, 0x0, sizeof(dbus_method_param_s));
@@ -4190,6 +4252,7 @@ int ws_activate(int concurrent)
 
        if (!g_pd) {
                WDP_LOGE("ws_dbus_plugin_data_s is not created yet");
+               __WDP_LOG_FUNC_EXIT__;
                return -1;
        }
 
@@ -4265,11 +4328,13 @@ int ws_deactivate(int concurrent)
 
        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;
        }
 
@@ -4358,7 +4423,6 @@ GLIST_ITER_END()
 }
 #endif /* TIZEN_FEATURE_ASP */
 
-
 int ws_start_scan(wfd_oem_scan_param_s *param)
 {
        __WDP_LOG_FUNC_ENTER__;
@@ -4370,17 +4434,20 @@ int ws_start_scan(wfd_oem_scan_param_s *param)
 
        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(&params, 0x0, sizeof(dbus_method_param_s));
@@ -4434,12 +4501,14 @@ int ws_restart_scan(int freq)
 
        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(&params, 0x0, sizeof(dbus_method_param_s));
@@ -4466,7 +4535,7 @@ int ws_restart_scan(int freq)
        return res;
 }
 
-int ws_stop_scan()
+int ws_stop_scan(void)
 {
        __WDP_LOG_FUNC_ENTER__;
        GDBusConnection *g_dbus = NULL;
@@ -4475,12 +4544,14 @@ int ws_stop_scan()
 
        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(&params, 0x0, sizeof(dbus_method_param_s));
@@ -4532,24 +4603,29 @@ int ws_get_peer_info(unsigned char *peer_addr, wfd_oem_device_s **peer)
 
        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;
        }
@@ -4705,17 +4781,20 @@ int ws_disconnect(unsigned char *peer_addr, int is_iface_addr)
 
        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(&params, 0x0, sizeof(dbus_method_param_s));
@@ -4887,7 +4966,7 @@ int ws_generate_pin(char **pin)
        return 0;
 }
 
-int ws_get_supported_wps_mode()
+int ws_get_supported_wps_mode(int *wps_mode)
 {
        __WDP_LOG_FUNC_ENTER__;
 
@@ -5064,12 +5143,14 @@ int ws_destroy_group(const char *ifname)
 
        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;
        }
 
@@ -5114,12 +5195,14 @@ int ws_invite(unsigned char *peer_addr, wfd_oem_invite_param_s *param)
 
        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(&params, 0x0, sizeof(dbus_method_param_s));
@@ -5162,12 +5245,14 @@ int ws_wps_start(unsigned char *peer_addr, int wps_mode, const char *pin)
 
        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;
        }
 
@@ -5222,7 +5307,7 @@ int ws_enrollee_start(unsigned char *peer_addr, int wps_mode, const char *pin)
        return 0;
 }
 
-int ws_wps_cancel()
+int ws_wps_cancel(void)
 {
        __WDP_LOG_FUNC_ENTER__;
        GDBusConnection *g_dbus = NULL;
@@ -5232,6 +5317,7 @@ int ws_wps_cancel()
        g_dbus = g_pd->g_dbus;
        if (!g_dbus) {
                WDP_LOGE("DBus connection is NULL");
+               __WDP_LOG_FUNC_EXIT__;
                return -1;
        }
        memset(&params, 0x0, sizeof(dbus_method_param_s));
@@ -5270,17 +5356,20 @@ int ws_set_dev_name(char *dev_name)
 
        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(&params, 0x0, sizeof(dbus_method_param_s));
@@ -5353,12 +5442,14 @@ int ws_get_go_intent(int *go_intent)
 
        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;
        }
 
@@ -5422,12 +5513,14 @@ int ws_set_go_intent(int go_intent)
 
        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(&params, 0x0, sizeof(dbus_method_param_s));
@@ -5469,12 +5562,14 @@ int ws_set_country(char *ccode)
 
        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(&params, 0x0, sizeof(dbus_method_param_s));
@@ -5838,12 +5933,14 @@ int ws_set_persistent_reconnect(unsigned char *bssid, int reconnect)
 
        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(&params, 0x0, sizeof(dbus_method_param_s));
@@ -6277,12 +6374,14 @@ int ws_serv_add(wfd_oem_new_service_s *service)
 
        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(&params, 0x0, sizeof(dbus_method_param_s));
@@ -6338,12 +6437,14 @@ int ws_serv_del(wfd_oem_new_service_s *service)
 
        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(&params, 0x0, sizeof(dbus_method_param_s));
@@ -6402,12 +6503,14 @@ int _ws_disable_display()
 
        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(&params, 0x0, sizeof(dbus_method_param_s));
@@ -6486,6 +6589,7 @@ int ws_set_display(wfd_oem_display_s *wifi_display)
        g_dbus = g_pd->g_dbus;
        if (!g_dbus) {
                WDP_LOGE("DBus connection is NULL");
+               __WDP_LOG_FUNC_EXIT__;
                return -1;
        }
        memset(&params, 0x0, sizeof(dbus_method_param_s));
@@ -6523,7 +6627,7 @@ int ws_set_display(wfd_oem_display_s *wifi_display)
 }
 #endif /* TIZEN_FEATURE_WIFI_DISPLAY */
 
-int ws_refresh()
+int ws_refresh(void)
 {
        __WDP_LOG_FUNC_ENTER__;
 
index 6fc25ff..ca7c259 100644 (file)
@@ -43,7 +43,6 @@
 #include "wifi-direct-session.h"
 #include "wifi-direct-log.h"
 
-
 /* Check the group instance which has same interface name,
  * before using this function */
 wfd_group_s *wfd_create_group(void *data, wfd_oem_event_s *group_info)
@@ -51,6 +50,7 @@ wfd_group_s *wfd_create_group(void *data, wfd_oem_event_s *group_info)
        __WDS_LOG_FUNC_ENTER__;
        wfd_group_s *group = NULL;
        wfd_manager_s *manager = (wfd_manager_s*) data;
+       char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
 
        if (!manager || !group_info) {
                WDS_LOGE("Invalid parameter");
@@ -75,7 +75,8 @@ wfd_group_s *wfd_create_group(void *data, wfd_oem_event_s *group_info)
        errno = 0;
        group = (wfd_group_s*) g_try_malloc0(sizeof(wfd_group_s));
        if (!group) {
-               WDS_LOGE("Failed to allocate memory for group. [%s]", strerror(errno));
+               strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+               WDS_LOGE("Failed to allocate memory for group. [%s]", error_buf);
                __WDS_LOG_FUNC_EXIT__;
                return NULL;
        }
@@ -107,6 +108,7 @@ wfd_group_s *wfd_create_pending_group(void *data, unsigned char * bssid)
        __WDS_LOG_FUNC_ENTER__;
        wfd_group_s *group = NULL;
        wfd_manager_s *manager = (wfd_manager_s*) data;
+       char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
 
        if (!manager || !bssid) {
                WDS_LOGE("Invalid parameter");
@@ -124,7 +126,8 @@ wfd_group_s *wfd_create_pending_group(void *data, unsigned char * bssid)
        errno = 0;
        group = (wfd_group_s*) g_try_malloc0(sizeof(wfd_group_s));
        if (!group) {
-               WDS_LOGE("Failed to allocate memory for group. [%s]", strerror(errno));
+               strerror_r(errno, error_buf, MAX_SIZE_ERROR_BUFFER);
+               WDS_LOGE("Failed to allocate memory for group. [%s]", error_buf);
                __WDS_LOG_FUNC_EXIT__;
                return NULL;
        }
@@ -395,6 +398,7 @@ int wfd_group_add_member(wfd_group_s *group, unsigned char *addr)
        member = wfd_group_find_member_by_addr(group, addr);
        if (member) {
                WDS_LOGE("Member already exist");
+               __WDS_LOG_FUNC_EXIT__;
                return -1;
        }
 
index 84dd488..c0b9ad3 100644 (file)
@@ -169,6 +169,7 @@ static int _wfd_local_init_device(wfd_manager_s *manager)
        __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");
@@ -178,7 +179,8 @@ static int _wfd_local_init_device(wfd_manager_s *manager)
        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;
        }
 
@@ -1207,6 +1209,7 @@ int wfd_manager_get_peer_info(wfd_manager_s *manager, unsigned char *addr, wfd_d
        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");
@@ -1233,7 +1236,8 @@ int wfd_manager_get_peer_info(wfd_manager_s *manager, unsigned char *addr, wfd_d
        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;
                }
@@ -1272,7 +1276,8 @@ int wfd_manager_get_peer_info(wfd_manager_s *manager, unsigned char *addr, wfd_d
 
        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;
        }
 
@@ -1312,6 +1317,7 @@ int wfd_manager_get_peers(wfd_manager_s *manager, wfd_discovery_entry_s **peers_
        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");
@@ -1338,7 +1344,8 @@ int wfd_manager_get_peers(wfd_manager_s *manager, wfd_discovery_entry_s **peers_
        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;
        }
 
@@ -1404,6 +1411,7 @@ int wfd_manager_get_connected_peers(wfd_manager_s *manager, wfd_connected_peer_i
        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");
@@ -1425,7 +1433,8 @@ int wfd_manager_get_connected_peers(wfd_manager_s *manager, wfd_connected_peer_i
        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;
        }
 
@@ -1606,7 +1615,7 @@ int wfd_manager_start_discovery(wfd_manager_s *manager, int mode, int timeout,
        wfd_oem_scan_param_s param;
        memset(&param, 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;
@@ -1766,6 +1775,7 @@ static void *wfd_plugin_init(wfd_manager_s *manager)
        void *handle;
        struct utsname kernel_info;
        int res;
+       char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
 
        if (!manager) {
                WDS_LOGE("Invalid parameter");
@@ -1798,7 +1808,8 @@ static void *wfd_plugin_init(wfd_manager_s *manager)
        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;
index feff461..5a39420 100644 (file)
@@ -130,6 +130,7 @@ int wfd_util_get_current_time(unsigned long *cur_time)
 {
        struct timespec time;
        int res;
+       char error_buf[MAX_SIZE_ERROR_BUFFER] = {0, };
 
        errno = 0;
        res = clock_gettime(CLOCK_REALTIME, &time);
@@ -138,7 +139,8 @@ int wfd_util_get_current_time(unsigned long *cur_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);
@@ -147,7 +149,8 @@ int wfd_util_get_current_time(unsigned long *cur_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;
 }
@@ -190,6 +193,7 @@ gboolean wfd_util_execute_file(const char *file_path,
        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]);
@@ -202,7 +206,8 @@ gboolean wfd_util_execute_file(const char *file_path,
 
                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) {
@@ -219,7 +224,8 @@ gboolean wfd_util_execute_file(const char *file_path,
                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;
 }
 
@@ -605,11 +611,13 @@ int wfd_util_get_local_dev_mac(unsigned char *dev_mac)
        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;
        }
@@ -617,7 +625,8 @@ int wfd_util_get_local_dev_mac(unsigned char *dev_mac)
        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;
@@ -698,11 +707,13 @@ int _connect_remote_device(char *ip_str)
        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;
        }
 
@@ -723,13 +734,15 @@ int _connect_remote_device(char *ip_str)
        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);
 
@@ -748,6 +761,7 @@ static void _dhcps_ip_leased_cb(keynode_t *key, void* data)
        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");
@@ -758,7 +772,8 @@ static void _dhcps_ip_leased_cb(keynode_t *key, void* data)
        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;
        }
 
@@ -1003,6 +1018,7 @@ int wfd_util_local_get_ip(char *ifname, unsigned char *ip_addr, int is_IPv6)
        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");
@@ -1013,7 +1029,8 @@ int wfd_util_local_get_ip(char *ifname, unsigned char *ip_addr, int is_IPv6)
        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__;
@@ -1027,7 +1044,8 @@ int wfd_util_local_get_ip(char *ifname, unsigned char *ip_addr, int is_IPv6)
        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;
@@ -1119,6 +1137,8 @@ static int _wfd_util_static_ip_set(const char *ifname, unsigned char *static_ip)
        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__;
@@ -1128,7 +1148,8 @@ static int _wfd_util_static_ip_set(const char *ifname, unsigned char *static_ip)
        /* 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;
        }
@@ -1136,7 +1157,8 @@ static int _wfd_util_static_ip_set(const char *ifname, unsigned char *static_ip)
        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;
        }
@@ -1181,10 +1203,12 @@ static int _wfd_util_static_ip_set(const char *ifname, unsigned char *static_ip)
        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]",