test-tool: Display SELinux status in output of libguestfs-test-tool.

This commit is contained in:
Richard W.M. Jones
2013-02-11 21:21:01 +00:00
parent 45b4271579
commit ee61d16e3e
2 changed files with 10 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ libguestfs_test_tool_CFLAGS = \
-DGUESTFS_WARN_DEPRECATED=1 \
-DLOCALEBASEDIR=\""$(datadir)/locale"\" \
-I$(top_srcdir)/src -I$(top_builddir)/src \
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
$(GPROF_CFLAGS) $(GCOV_CFLAGS)
libguestfs_test_tool_LDADD = \

View File

@@ -36,6 +36,8 @@
#include <guestfs.h>
#include "guestfs-internal-frontend.h"
#include "ignore-value.h"
#ifndef P_tmpdir
#define P_tmpdir "/tmp"
#endif
@@ -211,6 +213,13 @@ main (int argc, char *argv[])
if (p)
printf ("PATH=%s\n", p);
/* Print SELinux mode (don't worry if this fails, or if the command
* doesn't even exist).
*/
printf ("SELinux: ");
fflush (stdout); /* because getenforce prints output on stderr :-( */
ignore_value (system ("getenforce"));
/* Configure the handle. */
if (guestfs_add_drive_opts (g, tmpf,
GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",