]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/tmpfile-util-label.c
Merge pull request #25389 from fbuihuu/update-test-for-opensuse
[thirdparty/systemd.git] / src / shared / tmpfile-util-label.c
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2
3 #include <sys/stat.h>
4
5 #include "selinux-util.h"
6 #include "tmpfile-util-label.h"
7 #include "tmpfile-util.h"
8
9 int fopen_temporary_label(
10 const char *target,
11 const char *path,
12 FILE **f,
13 char **temp_path) {
14
15 int r;
16
17 assert(path);
18
19 r = mac_selinux_create_file_prepare(target, S_IFREG);
20 if (r < 0)
21 return r;
22
23 r = fopen_temporary(path, f, temp_path);
24
25 mac_selinux_create_file_clear();
26
27 return r;
28 }