git.annexia.org
/
libguestfs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
guestfs.h: Include <stdint.h>.
[libguestfs.git]
/
daemon
/
selinux.c
diff --git
a/daemon/selinux.c
b/daemon/selinux.c
index
6e2b347
..
e49e657
100644
(file)
--- a/
daemon/selinux.c
+++ b/
daemon/selinux.c
@@
-29,17
+29,30
@@
#include "../src/guestfs_protocol.h"
#include "daemon.h"
#include "actions.h"
#include "../src/guestfs_protocol.h"
#include "daemon.h"
#include "actions.h"
+#include "optgroups.h"
-#ifdef HAVE_LIBSELINUX
+#if defined(HAVE_LIBSELINUX)
+int
+optgroup_selinux_available (void)
+{
+ return 1;
+}
+#else /* !HAVE_LIBSELINUX */
+int
+optgroup_selinux_available (void)
+{
+ return 0;
+}
+#endif /* !HAVE_LIBSELINUX */
/* setcon is only valid under the following circumstances:
* - single threaded
* - enforcing=0
*/
int
/* setcon is only valid under the following circumstances:
* - single threaded
* - enforcing=0
*/
int
-do_setcon (char *context)
+do_setcon (c
onst c
har *context)
{
{
-#if
def HAVE_SETCON
+#if
defined(HAVE_LIBSELINUX) && defined(HAVE_SETCON)
if (setcon ((char *) context) == -1) {
reply_with_perror ("setcon");
return -1;
if (setcon ((char *) context) == -1) {
reply_with_perror ("setcon");
return -1;
@@
-47,15
+60,14
@@
do_setcon (char *context)
return 0;
#else
return 0;
#else
- reply_with_error ("%s is not available", __func__);
- return -1;
+ NOT_AVAILABLE (-1);
#endif
}
char *
do_getcon (void)
{
#endif
}
char *
do_getcon (void)
{
-#if
def HAVE_GETCON
+#if
defined(HAVE_LIBSELINUX) && defined(HAVE_GETCON)
security_context_t context;
char *r;
security_context_t context;
char *r;
@@
-73,9
+85,6
@@
do_getcon (void)
return r; /* caller frees */
#else
return r; /* caller frees */
#else
- reply_with_error ("%s is not available", __func__);
- return -1;
+ NOT_AVAILABLE (NULL);
#endif
}
#endif
}
-
-#endif /* HAVE_LIBSELINUX */