From 2dbeb638c02d3b0e705ebf194e555811a39f635e Mon Sep 17 00:00:00 2001 From: "hyunuk.tak" Date: Mon, 7 Sep 2020 10:47:55 +0900 Subject: [PATCH] Modify to copy interface name for wifi profile Change-Id: Iaa3110f3c074d686cf9c82b22cdc142f0a972e95 Signed-off-by: hyunuk.tak --- src/connection_profile.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/connection_profile.c b/src/connection_profile.c index cc38394..9d7ca8f 100755 --- a/src/connection_profile.c +++ b/src/connection_profile.c @@ -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; -- 2.7.4