From: Sebastian Harl Date: Wed, 2 Oct 2013 19:54:35 +0000 (+0200) Subject: store: Make sure not to store duplicate host entries. X-Git-Tag: sysdb-0.1.0~336^2~61 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d1a2a4ad9d5b06d7a8f289302695af91d532a694;p=sysdb.git store: Make sure not to store duplicate host entries. --- diff --git a/src/core/store.c b/src/core/store.c index 43a7a6b..19faee4 100644 --- a/src/core/store.c +++ b/src/core/store.c @@ -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));