Skip to content

Commit

Permalink
libsepol: improve policy lookup failure message
Browse files Browse the repository at this point in the history
If a policy version cannot be found include the policy target, and a
module prefix for non kernel policies in the message.

Signed-off-by: Christian Göttsche <[email protected]>
Acked-by: James Carter <[email protected]>
  • Loading branch information
cgzones authored and jwcart2 committed May 1, 2024
1 parent e81a05a commit fa3a1bc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libsepol/src/write.c
Expand Up @@ -2252,8 +2252,10 @@ int policydb_write(policydb_t * p, struct policy_file *fp)
info = policydb_lookup_compat(p->policyvers, p->policy_type,
p->target_platform);
if (!info) {
ERR(fp->handle, "compatibility lookup failed for policy "
"version %d", p->policyvers);
ERR(fp->handle, "compatibility lookup failed for %s%s policy version %d",
p->target_platform == SEPOL_TARGET_SELINUX ? "selinux" : "xen",
p->policy_type == POLICY_KERN ? "" : " module",
p->policyvers);
return POLICYDB_ERROR;
}

Expand Down

0 comments on commit fa3a1bc

Please sign in to comment.