chiark / gitweb /
Do no isolate in case of emergency or severe problems
[elogind.git] / src / shared / selinux-util.c
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
22 #include "selinux-util.h"
23
24 #ifdef HAVE_SELINUX
25
26 #include <selinux/selinux.h>
27
28 static int use_selinux_cached = -1;
29
30 bool 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
38 void retest_selinux(void) {
39         use_selinux_cached = -1;
40 }
41
42 #endif