diff mbox series

[iproute2-next,1/4] ss: make is_selinux_enabled stub work like in SELinux

Message ID 33564ea9f7c5c8d6f536a2c8db526ca1e14737a0.1692804730.git.aclaudi@redhat.com (mailing list archive)
State Accepted
Commit c8970828b6509af3ab0f2982da335fb6a6c846af
Delegated to: David Ahern
Headers show
Series make ip vrf exec SELinux-aware | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch, async

Commit Message

Andrea Claudi Aug. 23, 2023, 5:29 p.m. UTC
From the is_selinux_enabled() manpage:

is_selinux_enabled() returns 1 if SELinux is running or 0 if it is not.

This makes the is_selinux_enabled() stub functions works exactly like
the SELinux function it is supposed to replace.

Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
---
 misc/ss.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/misc/ss.c b/misc/ss.c
index 6d34ad0e..007cb349 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -77,7 +77,7 @@ 
 /* Stubs for SELinux functions */
 static int is_selinux_enabled(void)
 {
-	return -1;
+	return 0;
 }
 
 static int getpidcon(pid_t pid, char **context)
@@ -5682,7 +5682,7 @@  int main(int argc, char *argv[])
 			show_sock_ctx++;
 			/* fall through */
 		case 'Z':
-			if (is_selinux_enabled() <= 0) {
+			if (!is_selinux_enabled()) {
 				fprintf(stderr, "ss: SELinux is not enabled.\n");
 				exit(1);
 			}