]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/selinux-util.c
hwdb: Update database of Bluetooth company identifiers
[thirdparty/systemd.git] / src / shared / selinux-util.c
CommitLineData
cad45ba1
LP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3/***
4 This file is part of systemd.
5
6 Copyright 2010 Lennart Poettering
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20***/
21
cad45ba1
LP
22#include "selinux-util.h"
23
0b6018f3
CW
24#ifdef HAVE_SELINUX
25
26#include <selinux/selinux.h>
27
cad45ba1
LP
28static int use_selinux_cached = -1;
29
30bool use_selinux(void) {
31
32 if (use_selinux_cached < 0)
33 use_selinux_cached = is_selinux_enabled() > 0;
34
35 return use_selinux_cached;
36}
37
38void retest_selinux(void) {
39 use_selinux_cached = -1;
40}
0b6018f3 41
d682b3a7
LP
42#else
43
44bool use_selinux(void) {
45 return false;
46}
47
48void retest_selinux(void) {
49}
50
0b6018f3 51#endif