From 7bb8b9039c96278f904e3e7fa07953cd5e5b5113 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Wed, 5 Apr 2017 09:13:09 +0800 Subject: [PATCH] Update to new format from libsepol --- sepolicy.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sepolicy.c b/sepolicy.c index a5bfc9975..e43c604a3 100644 --- a/sepolicy.c +++ b/sepolicy.c @@ -357,15 +357,16 @@ int add_file_transition(char *s, char *t, char *c, char *d, char* filename) { return 1; } - filename_trans_t *new_transition = cmalloc(sizeof(*new_transition)); - new_transition->stype = src->s.value; - new_transition->ttype = tgt->s.value; - new_transition->tclass = cls->s.value; - new_transition->otype = def->s.value; - new_transition->name = strdup(filename); - new_transition->next = policy->filename_trans; + filename_trans_t *new_trans_key = cmalloc(sizeof(*new_trans_key)); + new_trans_key->stype = src->s.value; + new_trans_key->ttype = tgt->s.value; + new_trans_key->tclass = cls->s.value; + new_trans_key->name = strdup(filename); - policy->filename_trans = new_transition; + filename_trans_datum_t *new_trans_datam = cmalloc(sizeof(*new_trans_datam)); + new_trans_datam->otype = def->s.value; + + hashtab_insert(policy->filename_trans, (hashtab_key_t) new_trans_key, new_trans_datam); return 0; }