libselinux: drop error return from is_selinux_enabled.3
PATCH 1/1 libselinux: drop error return from is_selinux_enabled.3
is_selinux_enabled() does never return -1, do not say so in the manpage.
--- libselinux/man/man3/is_selinux_enabled.3 | 1 - 1 file changed, 1 deletion(-)
libselinux/man/man3/is_selinux_enabled.3 +0 -1
@@ -15,7 +15,6 @@ is_selinux_mls_enabled \- check whether SELinux is enabled for (Multi Level Secu .SH "DESCRIPTION" .BR is_selinux_enabled () returns 1 if SELinux is running or 0 if it is not. -On error, \-1 is returned. .BR is_selinux_mls_enabled () returns 1 if SELinux is capable of running in MLS mode or 0 if it is not. To
Signature · 1 line
2.25.0
Quoted 12 lines · Christian Göttsche
is_selinux_enabled()does never return -1, do not say so in the manpage.Signed-off-by Christian Göttsche <[email protected]>--- libselinux/man/man3/is_selinux_enabled.3 | 1 - 1 file changed, 1 deletion(-)libselinux/man/man3/is_selinux_enabled.3 +0
-0
libselinux/man/man3/is_selinux_enabled.3 is_selinux_mls_enabled \- check whether SELinux is enabled for (Multi Level Secu · line 20
Quoted 7 lines
libselinux/man/man3/is_selinux_enabled.3 +0
-1@@ -15,7 +15,6 @@ is_selinux_mls_enabled \- check whether SELinux is enabled for (Multi Level Secu .SH "DESCRIPTION" .BR is_selinux_enabled () returns 1 if SELinux is running or 0 if it is not. -On error, \-1 is returned. .BR is_selinux_mls_enabled () returns 1 if SELinux is capable of running in MLS mode or 0 if it is not. To
There's also
libselinux/include/selinux/selinux.h:
/* Return 1 if we are running on a SELinux kernel, or 0 if not or -1 if we get an error. */ extern int is_selinux_enabled(void);
Would you mind to update this as well?
Thanks,
Petr
Quoted 4 lines · Petr Lautrbach
Quoted 1 line · Christian Göttsche
is_selinux_enabled()does never return -1, do not say so in the manpage.
Just as a historical footnote: it used to be possible that it would return -1 prior to commit e3cab998b48ab293a9962faf9779d70ca339c65d circa release 20120216.
Quoted 34 lines
Quoted 11 lines
Signed-off-by Christian Göttsche <[email protected]>--- libselinux/man/man3/is_selinux_enabled.3 | 1 - 1 file changed, 1 deletion(-)libselinux/man/man3/is_selinux_enabled.3 +0
-0libselinux/man/man3/is_selinux_enabled.3 is_selinux_mls_enabled \- check whether SELinux is enabled for (Multi Level Secu · line 20
Quoted 7 lines
libselinux/man/man3/is_selinux_enabled.3 +0
-1@@ -15,7 +15,6 @@ is_selinux_mls_enabled \- check whether SELinux is enabled for (Multi Level Secu .SH "DESCRIPTION" .BR is_selinux_enabled () returns 1 if SELinux is running or 0 if it is not. -On error, \-1 is returned. .BR is_selinux_mls_enabled () returns 1 if SELinux is capable of running in MLS mode or 0 if it is not. ToThere's also
libselinux/include/selinux/selinux.h:/* Return 1 if we are running on a SELinux kernel, or 0 if not or -1 if we get an error. */ extern int
is_selinux_enabled(void);Would you mind to update this as well?
Thanks,
Petr
Am Fr., 7. Feb. 2020 um 18:51 Uhr schrieb Stephen Smalley <[email protected]>:
Quoted 6 lines · Petr Lautrbach
Quoted 4 lines
Quoted 1 line · Christian Göttsche
is_selinux_enabled()does never return -1, do not say so in the manpage.
I am having second thoughts about this:
With the current inaccurate documentation the worst effect are dead error handlers in client code.
But when removed now, after a potential SELinux rework (either kernel or userland) in some years it might be way harder to re-introduce error checking in all client applications.
Quoted 6 lines · Christian Göttsche
Am Fr., 7. Feb. 2020 um 18:51 Uhr schrieb Stephen Smalley <[email protected]>:
Quoted 5 lines · Petr Lautrbach
Quoted 3 lines
Christian Göttsche <[email protected]> writes:
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
is_selinux_enabled()does never return -1, do not say so in the manpage.I am having second thoughts about this:
With the current inaccurate documentation the worst effect are dead error handlers in client code.
But when removed now, after a potential SELinux rework (either kernel or userland) in some years it might be way harder to re-introduce error checking in all client applications.
Looking around at callers via codesearch, I don't see any actual error handlers for is_selinux_enabled() < 0. There is also inconsistent handling of the < 0 case; some code handles it the same as 0 (disabled) while other code handles any non-zero result as selinux-enabled. Probably better to fix the man page and header.
PATCH 1/1 libselinux: drop error return from is_selinux_enabled documentation
In reply to Christian GöttscheSince commit e3cab998b48ab293a9962faf9779d70ca339c65d ("libselinux mountpoint changing patch.") for version 20120216 is_selinux_enabled() does never return -1; drop mentions in the man-page and header file.
--- libselinux/include/selinux/selinux.h | 2 +- libselinux/man/man3/is_selinux_enabled.3 | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)
libselinux/include/selinux/selinux.h +1 -1
@@ -8,7 +8,7 @@extern "C" {#endif -/* Return 1 if we are running on a SELinux kernel, or 0 if not or -1 if we get an error. */ +/* Return 1 if we are running on a SELinux kernel, or 0 otherwise. */ extern int is_selinux_enabled (void );/* Return 1 if we are running on a SELinux MLS kernel, or 0 otherwise. */ extern int is_selinux_mls_enabled (void );
libselinux/man/man3/is_selinux_enabled.3 +0 -1
@@ -15,7 +15,6 @@ is_selinux_mls_enabled \- check whether SELinux is enabled for (Multi Level Secu .SH "DESCRIPTION" .BR is_selinux_enabled () returns 1 if SELinux is running or 0 if it is not. -On error, \-1 is returned. .BR is_selinux_mls_enabled () returns 1 if SELinux is capable of running in MLS mode or 0 if it is not. To
Signature · 1 line
2.25.0
Re: [PATCH] libselinux: drop error return from is_selinux_enabled documentation
Quoted 5 lines · Christian Göttsche
Since commit
e3cab998b48ab293a9962faf9779d70ca339c65d("libselinux mountpoint changing patch.") for version 20120216is_selinux_enabled()does never return -1; drop mentions in the man-page and header file.Signed-off-by Christian Göttsche <[email protected]>
Quoted 31 lines
--- libselinux/include/selinux/selinux.h | 2 +- libselinux/man/man3/is_selinux_enabled.3 | 1 - 2 files changed, 1 insertion(+), 2 deletions(-)libselinux/include/selinux/selinux.h +1
-1@@ -8,7 +8,7 @@extern "C" {#endif -/* Return 1 if we are running on a SELinux kernel, or 0 if not or -1 if we get an error. */ +/* Return 1 if we are running on a SELinux kernel, or 0 otherwise. */ extern int is_selinux_enabled (void );/* Return 1 if we are running on a SELinux MLS kernel, or 0 otherwise. */ extern int is_selinux_mls_enabled (void );libselinux/man/man3/is_selinux_enabled.3 +0
-1@@ -15,7 +15,6 @@ is_selinux_mls_enabled \- check whether SELinux is enabled for (Multi Level Secu .SH "DESCRIPTION" .BR is_selinux_enabled () returns 1 if SELinux is running or 0 if it is not. -On error, \-1 is returned. .BR is_selinux_mls_enabled () returns 1 if SELinux is capable of running in MLS mode or 0 if it is not. To
Stephen Smalley
AppliedRe: [PATCH] libselinux: drop error return from is_selinux_enabled documentation
Quoted 8 lines · Stephen Smalley
Quoted 5 lines · Christian Göttsche
Since commit
e3cab998b48ab293a9962faf9779d70ca339c65d("libselinux mountpoint changing patch.") for version 20120216is_selinux_enabled()does never return -1; drop mentions in the man-page and header file.Signed-off-by Christian Göttsche <[email protected]>Acked-by Stephen Smalley <[email protected]>
Thanks, applied.