summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Jones <rjones@centos5x32.home.annexia.org>2009-08-13 14:43:57 +0100
committerRichard Jones <rjones@trick.home.annexia.org>2009-08-13 16:19:21 +0100
commit9f7bec212fc7d146b4fd4be6e8b3e98677dc0a0a (patch)
treec7190641b3b971733957a971c29e019462ffd535
parent77b9dc04cf336e751287837fa35390d875b22e4b (diff)
downloadlibguestfs-9f7bec212fc7d146b4fd4be6e8b3e98677dc0a0a.tar.gz
libguestfs-9f7bec212fc7d146b4fd4be6e8b3e98677dc0a0a.tar.xz
libguestfs-9f7bec212fc7d146b4fd4be6e8b3e98677dc0a0a.zip
selinux: Don't fail if libselinux is not found.
-rw-r--r--daemon/selinux.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/daemon/selinux.c b/daemon/selinux.c
index ad5eaa15..3b4b9ba6 100644
--- a/daemon/selinux.c
+++ b/daemon/selinux.c
@@ -30,8 +30,6 @@
#include "daemon.h"
#include "actions.h"
-#ifdef HAVE_LIBSELINUX
-
/* setcon is only valid under the following circumstances:
* - single threaded
* - enforcing=0
@@ -39,7 +37,7 @@
int
do_setcon (const char *context)
{
-#ifdef HAVE_SETCON
+#if defined(HAVE_LIBSELINUX) && defined(HAVE_SETCON)
if (setcon ((char *) context) == -1) {
reply_with_perror ("setcon");
return -1;
@@ -55,7 +53,7 @@ do_setcon (const char *context)
char *
do_getcon (void)
{
-#ifdef HAVE_GETCON
+#if defined(HAVE_LIBSELINUX) && defined(HAVE_GETCON)
security_context_t context;
char *r;
@@ -74,8 +72,6 @@ do_getcon (void)
return r; /* caller frees */
#else
reply_with_error ("%s is not available", __func__);
- return -1;
+ return NULL;
#endif
}
-
-#endif /* HAVE_LIBSELINUX */