mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
build: accomodate selinux 2.5 header API change
Yet again, selinux has been adding const-correctness; this change
is ABI-compatible, but breaks API, which affects us when we try to
override things in our testsuite:
../../tests/securityselinuxhelper.c:307:24: error: conflicting types for 'selabel_open'
struct selabel_handle *selabel_open(unsigned int backend,
^~~~~~~~~~~~
In file included from ../../tests/securityselinuxhelper.c:32:0:
/usr/include/selinux/label.h:73:24: note: previous declaration of 'selabel_open' was here
The problem is a new 'const' prior to the second parameter.
Fix it the same way we did in commit 292d3f2d
: check for the new
const at configure time.
Signed-off-by: Eric Blake <eblake@redhat.com>
(cherry picked from commit e0509e7106525d3568fc7498c37287652da20e5d)
This commit is contained in:
parent
672eac6deb
commit
7040c65eb8
@ -1,6 +1,6 @@
|
|||||||
dnl The libselinux.so library
|
dnl The libselinux.so library
|
||||||
dnl
|
dnl
|
||||||
dnl Copyright (C) 2012-2014 Red Hat, Inc.
|
dnl Copyright (C) 2012-2014, 2016 Red Hat, Inc.
|
||||||
dnl
|
dnl
|
||||||
dnl This library is free software; you can redistribute it and/or
|
dnl This library is free software; you can redistribute it and/or
|
||||||
dnl modify it under the terms of the GNU Lesser General Public
|
dnl modify it under the terms of the GNU Lesser General Public
|
||||||
@ -41,6 +41,21 @@ int setcon(char *context);
|
|||||||
AC_DEFINE_UNQUOTED([VIR_SELINUX_CTX_CONST], [$lv_cv_setcon_const],
|
AC_DEFINE_UNQUOTED([VIR_SELINUX_CTX_CONST], [$lv_cv_setcon_const],
|
||||||
[Define to empty or 'const' depending on how SELinux qualifies its
|
[Define to empty or 'const' depending on how SELinux qualifies its
|
||||||
security context parameters])
|
security context parameters])
|
||||||
|
# ...and again for 2.5
|
||||||
|
AC_CACHE_CHECK([for selinux selabel_open parameter type],
|
||||||
|
[lv_cv_selabel_open_const],
|
||||||
|
[AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_PROGRAM(
|
||||||
|
[[
|
||||||
|
#include <selinux/selinux.h>
|
||||||
|
#include <selinux/label.h>
|
||||||
|
struct selabel_handle *selabel_open(unsigned, struct selinux_opt *, unsigned);
|
||||||
|
]])],
|
||||||
|
[lv_cv_selabel_open_const=''],
|
||||||
|
[lv_cv_selabel_open_const='const'])])
|
||||||
|
AC_DEFINE_UNQUOTED([VIR_SELINUX_OPEN_CONST], [$lv_cv_selabel_open_const],
|
||||||
|
[Define to empty or 'const' depending on how SELinux qualifies its
|
||||||
|
selabel_open parameter])
|
||||||
|
|
||||||
AC_MSG_CHECKING([SELinux mount point])
|
AC_MSG_CHECKING([SELinux mount point])
|
||||||
if test "$with_selinux_mount" = "check" || test -z "$with_selinux_mount"; then
|
if test "$with_selinux_mount" = "check" || test -z "$with_selinux_mount"; then
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2011-2013 Red Hat, Inc.
|
* Copyright (C) 2011-2013, 2016 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -60,6 +60,7 @@ static const char *(*realselinux_lxc_contexts_path)(void);
|
|||||||
|
|
||||||
#if HAVE_SELINUX_LABEL_H
|
#if HAVE_SELINUX_LABEL_H
|
||||||
static struct selabel_handle *(*realselabel_open)(unsigned int backend,
|
static struct selabel_handle *(*realselabel_open)(unsigned int backend,
|
||||||
|
VIR_SELINUX_OPEN_CONST
|
||||||
struct selinux_opt *opts,
|
struct selinux_opt *opts,
|
||||||
unsigned nopts);
|
unsigned nopts);
|
||||||
static void (*realselabel_close)(struct selabel_handle *handle);
|
static void (*realselabel_close)(struct selabel_handle *handle);
|
||||||
@ -304,9 +305,10 @@ const char *selinux_lxc_contexts_path(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_SELINUX_LABEL_H
|
#if HAVE_SELINUX_LABEL_H
|
||||||
struct selabel_handle *selabel_open(unsigned int backend,
|
struct selabel_handle *
|
||||||
struct selinux_opt *opts,
|
selabel_open(unsigned int backend,
|
||||||
unsigned nopts)
|
VIR_SELINUX_OPEN_CONST struct selinux_opt *opts,
|
||||||
|
unsigned nopts)
|
||||||
{
|
{
|
||||||
char *fake_handle;
|
char *fake_handle;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user