[refpolicy] [PATCH 1/3]checkpolicy Fix error: variable 'newattr' set but not used(and others as well)

Justin P. Mattock justinmattock at gmail.com
Tue Jul 6 17:23:28 CDT 2010


The below patch fixes some warning messages Im receiving
with GCC:(in this case some are erros due to -Werror)
policy_define.c: In function 'define_type':
policy_define.c:1216:6: error: variable 'newattr' set but not used
cc1: all warnings being treated as errors

Signed-off-by: Justin P. Mattock <justinmattock at gmail.com>

---
 checkpolicy/policy_define.c |    3 ---
 checkpolicy/test/dismod.c   |    2 --
 2 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
index a064307..82ab44c 100644
--- a/checkpolicy/policy_define.c
+++ b/checkpolicy/policy_define.c
@@ -1213,7 +1213,6 @@ int define_type(int alias)
 {
 	char *id;
 	type_datum_t *datum, *attr;
-	int newattr = 0;
 
 	if (pass == 2) {
 		/*
@@ -1266,8 +1265,6 @@ int define_type(int alias)
 			/* treat it as a fatal error */
 			yyerror2("attribute %s is not declared", id);
 			return -1;
-		} else {
-			newattr = 0;
 		}
 
 		if (attr->flavor != TYPE_ATTRIB) {
diff --git a/checkpolicy/test/dismod.c b/checkpolicy/test/dismod.c
index 705f1cb..4d31597 100644
--- a/checkpolicy/test/dismod.c
+++ b/checkpolicy/test/dismod.c
@@ -474,11 +474,9 @@ void display_role_allow(role_allow_rule_t * ra, policydb_t * p, FILE * fp)
 
 int role_display_callback(hashtab_key_t key, hashtab_datum_t datum, void *data)
 {
-	char *id;
 	role_datum_t *role;
 	FILE *fp;
 
-	id = key;
 	role = (role_datum_t *) datum;
 	fp = (FILE *) data;
 
-- 
1.7.1.rc1.21.gf3bd6



More information about the refpolicy mailing list