[PATCH] gsupplicant: fix finding matching group
g_slist_find_custom() expects a function that return 0 when the arguments are equal. g_str_equal() returns TRUE, so any not matching group is found. --- gsupplicant/supplicant.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 81fcadc639bd..8c49c1ee8c99 100755 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -2678,7 +2678,7 @@ static void peer_groups_relation(DBusMessageIter *iter, void *user_data) if (!group) return; - elem = g_slist_find_custom(data->old_groups, str, g_str_equal); + elem = g_slist_find_custom(data->old_groups, str, (GCompareFunc)g_strcmp0); if (elem) { data->old_groups = g_slist_remove_link(data->old_groups, elem); peer->groups = g_slist_concat(elem, peer->groups); -- 2.1.4 ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
Re: [PATCH] gsupplicant: fix finding matching group
Hi Michael, ACK from me. Tomasz g_slist_find_custom() expects a function that return 0 when the arguments are equal. g_str_equal() returns TRUE, so any not matching group is found. --- gsupplicant/supplicant.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gsupplicant/supplicant.c b/gsupplicant/supplicant.c index 81fcadc639bd..8c49c1ee8c99 100755 --- a/gsupplicant/supplicant.c +++ b/gsupplicant/supplicant.c @@ -2678,7 +2678,7 @@ static void peer_groups_relation(DBusMessageIter *iter, void *user_data) if (!group) return; - elem = g_slist_find_custom(data->old_groups, str, g_str_equal); + elem = g_slist_find_custom(data->old_groups, str, (GCompareFunc)g_strcmp0); if (elem) { data->old_groups = g_slist_remove_link(data->old_groups, elem); peer->groups = g_slist_concat(elem, peer->groups); ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman
Re: [PATCH] gsupplicant: fix finding matching group
On Fri, 2015-05-29 at 14:06 +0200, Michael Olbrich wrote: > g_slist_find_custom() expects a function that return 0 when the arguments > are equal. g_str_equal() returns TRUE, so any not matching group is found. Applied, thanks! Patrik ___ connman mailing list connman@connman.net https://lists.connman.net/mailman/listinfo/connman