>From 07ef8a3138bac38245ee86be5e3759eac2363f17 Mon Sep 17 00:00:00 2001 From: Assaf Gordon Date: Sun, 2 Jun 2019 01:11:19 -0600 Subject: [PATCH 1/2] sed: report SELinux status in --version output Report whether sed was built with SELinux support (determined at compile time), and whether it is enabled on this system (determined at runtime). Relates to https://bugs.gnu.org/35997 . * sed/sed.c (selinux_support): New function, print SELinux status to stdout. (main): Call selinux_support on --version. --- sed/sed.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/sed/sed.c b/sed/sed.c index ea147e6..e43a92e 100644 --- a/sed/sed.c +++ b/sed/sed.c @@ -29,6 +29,7 @@ #include "progname.h" #include "version.h" #include "xalloc.h" +#include #include "version-etc.h" @@ -130,6 +131,22 @@ General help using GNU software: .\n")); fprintf (out, _("E-mail bug reports to: <%s>.\n"), PACKAGE_BUGREPORT); } +static void +selinux_support (void) +{ + putchar ('\n'); +#if HAVE_SELINUX_SELINUX_H + puts (_("This sed program was built with SELinux support.")); + if (is_selinux_enabled()) + puts (_("SELinux is enabled on this system.")); + else + puts (_("SELinux is disabled on this system.")); +#else + puts (_("This sed program was built without SELinux support.")); +#endif + putchar ('\n'); +} + _Noreturn static void usage (int status) { @@ -344,6 +361,7 @@ main (int argc, char **argv) case 'v': version_etc (stdout, program_name, PACKAGE_NAME, Version, AUTHORS, (char *) NULL); + selinux_support (); contact (false); ck_fclose (NULL); exit (EXIT_SUCCESS); -- 2.11.0