libsepol/cil: Do not add NULL node when inserting key into symtab
Allow inserting a key without providing a node. This will make it easier to properly resolve call arguments where a key might need to be temporarily removed to search for a datum that is not declared within the call. Since the node is already in the node list, re-inserting the key without this option would add another link to the node and cause problems. Also, do not add the node to the datum's node list if the result of the call to hashtab_insert() is SEPOL_EEXIST because the datum is a duplicate and will be destroyed. Signed-off-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
parent
788d40b0e6
commit
a1952af7c0
1 changed files with 4 additions and 4 deletions
|
@ -93,10 +93,10 @@ int cil_symtab_insert(symtab_t *symtab, hashtab_key_t key, struct cil_symtab_dat
|
|||
datum->fqn = key;
|
||||
datum->symtab = symtab;
|
||||
symtab->nprim++;
|
||||
cil_list_append(datum->nodes, CIL_NODE, node);
|
||||
} else if (rc == SEPOL_EEXIST) {
|
||||
cil_list_append(datum->nodes, CIL_NODE, node);
|
||||
} else {
|
||||
if (node) {
|
||||
cil_list_append(datum->nodes, CIL_NODE, node);
|
||||
}
|
||||
} else if (rc != SEPOL_EEXIST) {
|
||||
cil_symtab_error("Failed to insert datum into hashtab\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue