Skip to content

Commit

Permalink
checkpolicy: provide more descriptive error messages
Browse files Browse the repository at this point in the history
Provide more descriptive error messages by including the identifier
or other kind of value if available.

Also drop duplicate newlines at the end of messages.

Signed-off-by: Christian Göttsche <[email protected]>
Acked-by: James Carter <[email protected]>
  • Loading branch information
cgzones authored and jwcart2 committed Mar 4, 2024
1 parent fbd6c0f commit 4e407ba
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 53 deletions.
6 changes: 3 additions & 3 deletions checkpolicy/module_compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static void print_error_msg(int ret, uint32_t symbol_type)
yyerror2("Could not declare %s here", flavor_str[symbol_type]);
break;
default:
yyerror("Unknown error");
yyerror2("Unknown error %d", ret);
}
}

Expand All @@ -86,7 +86,7 @@ int define_policy(int pass, int module_header_given)
if (module_header_given) {
if (policydbp->policy_type != POLICY_MOD) {
yyerror
("Module specification found while not building a policy module.\n");
("Module specification found while not building a policy module.");
return -1;
}

Expand All @@ -111,7 +111,7 @@ int define_policy(int pass, int module_header_given)
} else {
if (policydbp->policy_type == POLICY_MOD) {
yyerror
("Building a policy module, but no module specification found.\n");
("Building a policy module, but no module specification found.");
return -1;
}
}
Expand Down

0 comments on commit 4e407ba

Please sign in to comment.