libselinux: copy the reason why selinux_status_open() returns 1

The function comment of selinux_status_open() states:

    It returns 0 on success, or -1 on error.

However the implementation of this function can also return 1. This is
documented in its manpage (libselinux/man/man3/selinux_status_open.3) as
intended. Copy the reason near the function definition in order to make
the code more auditable.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
Nicolas Iooss 2020-04-12 10:10:00 +02:00 committed by William Roberts
parent 0bcaba30d7
commit 164f437b19

View File

@ -250,7 +250,9 @@ static int fallback_cb_policyload(int policyload)
* Since Linux 2.6.37 or later supports this feature, we may run
* fallback routine using a netlink socket on older kernels, if
* the supplied `fallback' is not zero.
* It returns 0 on success, or -1 on error.
* It returns 0 on success, -1 on error or 1 when we are ready to
* use these interfaces, but netlink socket was opened as fallback
* instead of the kernel status page.
*/
int selinux_status_open(int fallback)
{