NAME |SYNOPSIS |DESCRIPTION |RETURN VALUE |SEE ALSO |COLOPHON | |
set_matc...on_flags(3) SELinux API documentationset_matc...on_flags(3)set_matchpathcon_flags, set_matchpathcon_invalidcon, set_matchpathcon_printf - set flags controlling the operation of matchpathcon or matchpathcon_index and configure the behaviour of validity checking and error displaying
#include <selinux/selinux.h>void set_matchpathcon_flags(unsigned intflags);void set_matchpathcon_invalidcon(int (*f)(const char *path,unsignedlineno, char *context));void set_matchpathcon_printf(void (*f)(const char *fmt, ...));
set_matchpathcon_flags() sets the flags controlling the operation ofmatchpathcon_init(3) and subsequentlymatchpathcon_index(3) ormatchpathcon(3). If theMATCHPATHCON_BASEONLYflag is set, then only the base file contexts configuration file will be processed, not any dynamically generated entries or local customizations.set_matchpathcon_invalidcon() sets the function used bymatchpathcon_init(3) when checking the validity of a context in the file contexts configuration. If not set, then this defaults to a test based onsecurity_check_context(3), which checks validity against the active policy on a SELinux system. This can be set to instead perform checking based on a binary policy file, e.g. usingsepol_check_context(3), as is done bysetfiles -c.The function is also responsible for reporting any such error, and may include thepath andlineno in such error messages.set_matchpathcon_printf() sets the function used bymatchpathcon_init(3) when displaying errors about the file contexts configuration. If not set, then this defaults to fprintf(stderr, fmt, ...). This can be set to redirect error reporting to a different destination.
Returns zero on success or -1 otherwise.
selinux(8),matchpathcon(3),matchpathcon_index(3),set_matchpathcon_invalidcon(3),set_matchpathcon_printf(3),freecon(3),setfilecon(3),setfscreatecon(3)
This page is part of theselinux (Security-Enhanced Linux user- space libraries and tools) project. Information about the project can be found at ⟨https://github.com/SELinuxProject/selinux/wiki⟩. If you have a bug report for this manual page, see ⟨https://github.com/SELinuxProject/selinux/wiki/Contributing⟩. This page was obtained from the project's upstream Git repository ⟨https://github.com/SELinuxProject/selinux⟩ on 2025-08-11. (At that time, the date of the most recent commit that was found in the repository was 2025-08-04.) If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up-to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which isnot part of the original manual page), send a mail to man-pages@man7.orgstephen.smalley.work@gmai... 21 November 2009set_matc...on_flags(3)Pages that refer to this page:matchpathcon(3), set_matchpathcon_flags(3)
HTML rendering created 2025-09-06 byMichael Kerrisk, author ofThe Linux Programming Interface. For details of in-depthLinux/UNIX system programming training courses that I teach, lookhere. Hosting byjambit GmbH. | ![]() |