Modify to copy interface name for wifi profile 44/243344/1 submit/tizen/20200909.082116
authorhyunuk.tak <hyunuk.tak@samsung.com>
Mon, 7 Sep 2020 01:47:55 +0000 (10:47 +0900)
committerhyunuk.tak <hyunuk.tak@samsung.com>
Mon, 7 Sep 2020 01:47:58 +0000 (10:47 +0900)
Change-Id: Iaa3110f3c074d686cf9c82b22cdc142f0a972e95
Signed-off-by: hyunuk.tak <hyunuk.tak@samsung.com>
src/connection_profile.c

index cc38394..9d7ca8f 100755 (executable)
@@ -229,27 +229,18 @@ static void __profile_init_cellular_profile(net_profile_info_t *profile_info, co
 
 static int __profile_init_wifi_profile(net_profile_info_t *profile_info)
 {
-       GSList *list = NULL;
        GSList *interface_list = NULL;
+       const char *interface_name = NULL;
 
        if (net_get_wifi_interface_list(NULL, &interface_list) != NET_ERR_NONE) {
                CONNECTION_LOG(CONNECTION_ERROR, "Fail to get interface list");
                return CONNECTION_ERROR_OPERATION_FAILED;
        }
 
-       for (list = interface_list; list; list = list->next) {
-               const char *interface_name = list->data;
-               g_strlcpy(profile_info->ProfileName, interface_name, NET_PROFILE_NAME_LEN_MAX);
-               g_strlcpy(profile_info->ProfileInfo.Wlan.net_info.ProfileName,
-                               interface_name, NET_PROFILE_NAME_LEN_MAX);
-               break;
-       }
-
-       if (list == NULL) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Fail to get interface name");
-               g_slist_free_full(interface_list, g_free);
-               return CONNECTION_ERROR_INVALID_OPERATION;
-       }
+       interface_name = interface_list->data;
+       g_strlcpy(profile_info->ProfileName, interface_name, NET_PROFILE_NAME_LEN_MAX);
+       g_strlcpy(profile_info->ProfileInfo.Wlan.net_info.ProfileName,
+                       interface_name, NET_PROFILE_NAME_LEN_MAX);
 
        profile_info->profile_type = NET_DEVICE_WIFI;
        profile_info->ProfileState = NET_STATE_TYPE_IDLE;