1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
4 This file is part of systemd.
6 Copyright 2010 Lennart Poettering
7 Copyright 2010 Harald Hoyer
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 #include <sys/types.h>
27 #include "selinux-util.h"
29 #include "fileio-label.h"
31 int write_string_file_atomic_label(const char *fn, const char *line) {
34 r = mac_selinux_create_file_prepare(fn, S_IFREG);
38 r = write_string_file_atomic(fn, line);
40 mac_selinux_create_file_clear();
45 int write_env_file_label(const char *fname, char **l) {
48 r = mac_selinux_create_file_prepare(fname, S_IFREG);
52 r = write_env_file(fname, l);
54 mac_selinux_create_file_clear();
59 int fopen_temporary_label(const char *target,
60 const char *path, FILE **f, char **temp_path) {
63 r = mac_selinux_create_file_prepare(target, S_IFREG);
67 r = fopen_temporary(path, f, temp_path);
69 mac_selinux_create_file_clear();