From 5d56c2679d3fff113c76bd8bd7846628a2e46f04 Mon Sep 17 00:00:00 2001 From: James Carter Date: Tue, 31 Jan 2017 13:47:48 -0500 Subject: [PATCH] checkpolicy: Remove uneeded return check in require_symbol() Since symtab_insert() no longer returns -2 in the case of a declaration of an identifier followed by a require of the same symbol, remove the uneeded check. Signed-off-by: James Carter --- checkpolicy/module_compiler.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/checkpolicy/module_compiler.c b/checkpolicy/module_compiler.c index c6856144..24e72e2b 100644 --- a/checkpolicy/module_compiler.c +++ b/checkpolicy/module_compiler.c @@ -719,23 +719,15 @@ int require_symbol(uint32_t symbol_type, avrule_decl_t *decl = stack_top->decl; int ret = create_symbol(symbol_type, key, datum, dest_value, SCOPE_REQ); - if (ret == 0 || ret == 1) { - if (ebitmap_set_bit(decl->required.scope + symbol_type, - *datum_value - 1, 1)) { - return -3; - } - } else if (ret == -2) { - /* ignore require statements if that symbol was - * previously declared and is in current scope */ - if (is_id_in_scope(symbol_type, key)) { - ret = 1; - } else { - return -2; - } - } else if (ret < 0) { + if (ret < 0) { return ret; } + if (ebitmap_set_bit(decl->required.scope + symbol_type, + *datum_value - 1, 1)) { + return -3; + } + stack_top->require_given = 1; return ret; }