---
name: "sepol_check_context"
section: "3"
platform: "linux"
package: "libsepol-dev"
version: "3.8.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/sepol_check_context"
---

# sepol\_check\_context(3)

Check the validity of a security context against a binary policy.

## NAME

sepol\_check\_context - Check the validity of a security context against a binary policy.

## SYNOPSIS

**#include \<sepol/sepol.h\>**

**int sepol\_check\_context(const char \****context***);**

**int sepol\_set\_policydb\_from\_file(FILE \****fp***);**

## DESCRIPTION

**sepol\_check\_context** checks the validity of a security context against a binary policy previously loaded from a file via **sepol\_set\_policydb\_from\_file.** It is used by  **setfiles -c** to validate a file contexts configuration against the binary policy upon policy builds.  For validating a context against the active policy on a SELinux system, use **security\_check\_context** from libselinux instead.

## RETURN VALUE

Returns 0 on success or -1 with errno set otherwise.
