summaryrefslogtreecommitdiff
path: root/src/selinux.h
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2013-11-27 18:21:48 +0000
committerPádraig Brady <P@draigBrady.com>2013-11-27 20:59:23 +0000
commit7e39ef9f883ed788ce98329383ab071398e28b6d (patch)
tree60002a40cfe1c6868b2888596f9a53bc73c255fd /src/selinux.h
parent1e16de1de4a9172cf9a13a469cfc8a58738ec8fa (diff)
downloadcoreutils-7e39ef9f883ed788ce98329383ab071398e28b6d.tar.xz
build: avoid more selinux build failures
Handle both newer selinux libraries with mode_to_security_class(), and systems without selinux at all. We could easily adjust gnulib to provide the necessary stubs for use by this module, but it's more efficient to just stub out the module completely, when not using selinux. * src/selinux.h: Define stubs for the two module functions, when SELinux is not available. * src/selinux.c: Exclude all logic in preference for the stubs when selinux isn't used. Also when newer selinux libs are used, don't use our conflicting static version of mode_to_security_class(). m4/jm-macros.m4: Check for the system mode_to_security_class().
Diffstat (limited to 'src/selinux.h')
-rw-r--r--src/selinux.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/selinux.h b/src/selinux.h
index f60c083ac..31771632e 100644
--- a/src/selinux.h
+++ b/src/selinux.h
@@ -19,7 +19,21 @@
#ifndef COREUTILS_SELINUX_H
# define COREUTILS_SELINUX_H
+# if HAVE_SELINUX_SELINUX_H
+
extern bool restorecon (char const *path, bool recurse, bool preserve);
extern int defaultcon (char const *path, mode_t mode);
+# else
+
+static inline bool
+restorecon (char const *path, bool recurse, bool preserve)
+{ errno = ENOTSUP; return false; }
+
+static inline int
+defaultcon (char const *path, mode_t mode)
+{ errno = ENOTSUP; return -1; }
+
+# endif
+
#endif