changeset 1761:563ec6dfc751

Cleanup getenforce.
author Rob Landley <rob@landley.net>
date Fri, 27 Mar 2015 21:52:24 -0500
parents c21fe4bc2249
children e65b19c2baf6
files toys/pending/getenforce.c
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/toys/pending/getenforce.c	Fri Mar 27 21:41:14 2015 -0500
+++ b/toys/pending/getenforce.c	Fri Mar 27 21:52:24 2015 -0500
@@ -7,6 +7,7 @@
 config GETENFORCE
   bool "getenforce"
   default n
+  depends on TOYBOX_SELINUX
   help
     usage: getenforce
 
@@ -15,17 +16,14 @@
 
 #define FOR_getenforce
 #include "toys.h"
-#include <selinux/selinux.h>
 
 void getenforce_main(void)
 {
-  if (!is_selinux_enabled())
-    printf("Disabled\n");
+  if (!is_selinux_enabled()) puts("Disabled");
   else {
     int ret = security_getenforce();
-    if (ret == -1)
-      perror_exit("Couldn't get enforcing status");
-    else
-      printf(ret ? "Enforcing\n" : "Permissive\n");
+
+    if (ret == -1) perror_exit("Couldn't get enforcing status");
+    else puts(ret ? "Enforcing" : "Permissive");
   }
 }