char **next)
{
int rc = 0;
+# ifdef HAVE_SELINUX_CONTEXT_T
+ security_context_t raw = NULL; /* deprecated */
+# else
+ char *raw = NULL; /* since libselinux >= 3.1 */
+# endif
- security_context_t raw = NULL;
char *p, *val, *begin, *end;
size_t sz;
/* translate the context */
- rc = selinux_trans_to_raw_context((security_context_t) p, &raw);
+ rc = selinux_trans_to_raw_context(
+# ifdef HAVE_SELINUX_CONTEXT_T
+ (security_context_t)
+# endif
+ p, &raw);
DBG(CXT, ul_debug("SELinux context '%s' translated to '%s'",
p, rc == -1 ? "FAILED" : (char *) raw));
}
#if defined(HAVE_LIBSELINUX) && defined(HAVE_SECURITY_GET_INITIAL_CONTEXT)
-#include <selinux/selinux.h>
-#include <selinux/context.h>
+# include <selinux/selinux.h>
+# include <selinux/context.h>
static void selinux_warning(struct libmnt_context *cxt, const char *tgt)
{
if (tgt && mnt_context_is_verbose(cxt) && is_selinux_enabled() > 0) {
- security_context_t raw = NULL, def = NULL;
+# ifdef HAVE_SELINUX_CONTEXT_T
+ security_context_t raw = NULL, def = NULL; /* deprecated */
+# else
+ char *raw = NULL, *def = NULL; /* since libselinux >= 3.1 */
+# endif
if (getfilecon(tgt, &raw) > 0
&& security_get_initial_context("file", &def) == 0) {