Code

store: Make sure not to store duplicate host entries.
authorSebastian Harl <sh@tokkee.org>
Wed, 2 Oct 2013 19:54:35 +0000 (21:54 +0200)
committerSebastian Harl <sh@tokkee.org>
Wed, 2 Oct 2013 19:54:35 +0000 (21:54 +0200)
src/core/store.c

index 43a7a6bda20d1228f8fa6b389a5c9710d92936a2..19faee43994bdde816a6a84f4c09061bfb25bb4f 100644 (file)
@@ -309,7 +309,10 @@ store_obj(int parent_type, const char *parent_name,
        }
 
        /* TODO: only look into direct children? */
-       if (type == SDB_ATTRIBUTE)
+       if (type == SDB_HOST)
+               /* make sure that each host is unique */
+               old = STORE_OBJ(sdb_store_lookup_in_list(obj_list, type, name));
+       else if (type == SDB_ATTRIBUTE)
                old = STORE_OBJ(sdb_llist_search_by_name(parent_list, name));
        else
                old = STORE_OBJ(sdb_store_lookup_in_list(parent_list, type, name));