]> git.proxmox.com Git - mirror_corosync.git/commitdiff
fixe a bug in cpg where get_group() will return the wrong group
authorPatrick Caulfield <pcaulfie@redhat.com>
Fri, 11 Aug 2006 07:37:15 +0000 (07:37 +0000)
committerPatrick Caulfield <pcaulfie@redhat.com>
Fri, 11 Aug 2006 07:37:15 +0000 (07:37 +0000)
info structure if there is a hash collision.

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1199 fd59a12c-fef9-0310-b244-a6a79926bd2f

exec/cpg.c

index af51e6d6f5634ce8cc09403b59890ed3114c9ca7..6066703ae4a6fbe4c2292519fffc8ecd8c0b2282 100644 (file)
@@ -464,12 +464,15 @@ static struct group_info *get_group(mar_cpg_name_t *name)
 {
        struct list_head *iter;
        struct group_info *gi = NULL;
+       struct group_info *itergi;
        uint32_t hash = jhash(name->value, name->length, 0) % GROUP_HASH_SIZE;
 
        for (iter = group_lists[hash].next; iter != &group_lists[hash]; iter = iter->next) {
-               gi = list_entry(iter, struct group_info, list);
-               if (memcmp(gi->group_name.value, name->value, name->length) == 0)
+               itergi = list_entry(iter, struct group_info, list);
+               if (memcmp(itergi->group_name.value, name->value, name->length) == 0) {
+                       gi = itergi;
                        break;
+               }
        }
 
        if (!gi) {