libselinux: test for file_contexts.bin format

Check to see if the file whose path is passed to selabel_open() starts
with the file_contexts.bin magic number, and if so, automatically
treat it as a file_contexts.bin file.  This allows one to open
file_contexts.bin formatted files without necessarily having a .bin
file suffix.  This removes the need for the previously added
.bin file suffix test.

Change-Id: I6a0cb303954cc6fa24c437ccc794104859eac24b
Signed-off-by: Stephen Smalley <>
1 file changed