]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ss: make is_selinux_enabled stub work like in SELinux
authorAndrea Claudi <aclaudi@redhat.com>
Wed, 23 Aug 2023 17:29:59 +0000 (19:29 +0200)
committerDavid Ahern <dsahern@kernel.org>
Fri, 25 Aug 2023 00:34:07 +0000 (17:34 -0700)
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>
Signed-off-by: David Ahern <dsahern@kernel.org>
misc/ss.c

index 6d34ad0e070b611f3896c5e7b91d24739bb27e04..007cb3490760c85e78e009994424e00758ca62bd 100644 (file)
--- 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);
                        }