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>
26 #include "fileio-label.h"
30 int write_string_file_atomic_label(const char *fn, const char *line) {
33 r = mac_selinux_create_file_prepare(fn, S_IFREG);
37 r = write_string_file_atomic(fn, line);
39 mac_selinux_create_file_clear();
44 int write_env_file_label(const char *fname, char **l) {
47 r = mac_selinux_create_file_prepare(fname, S_IFREG);
51 r = write_env_file(fname, l);
53 mac_selinux_create_file_clear();
58 int fopen_temporary_label(const char *target,
59 const char *path, FILE **f, char **temp_path) {
62 r = mac_selinux_create_file_prepare(target, S_IFREG);
66 r = fopen_temporary(path, f, temp_path);
68 mac_selinux_create_file_clear();