X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=daemon%2Fselinux.c;h=3b4b9ba61d7663db72b3dc6056f2f8587215321d;hb=c372c7c23a298a940b8a0868396ef2ae0d824e4d;hp=6e2b347eb73e4258cafa5f22eda8a0431a869c1a;hpb=67a679afb17747b5ec392e56cf6121b085b38a3a;p=libguestfs.git diff --git a/daemon/selinux.c b/daemon/selinux.c index 6e2b347..3b4b9ba 100644 --- a/daemon/selinux.c +++ b/daemon/selinux.c @@ -30,16 +30,14 @@ #include "daemon.h" #include "actions.h" -#ifdef HAVE_LIBSELINUX - /* setcon is only valid under the following circumstances: * - single threaded * - enforcing=0 */ int -do_setcon (char *context) +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 (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 */