Debian Codegraph @

src/shared/tmpfile-util.c

raw
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.h"
7
8 int fopen_temporary_at_label(
9 int dir_fd,
10 const char *target,
11 const char *path,
12 FILE **f,
13 char **temp_path) {
14
15 int r;
16
17 assert(dir_fd >= 0 || dir_fd == AT_FDCWD);
18 assert(path);
19
20 r = mac_selinux_create_file_prepare_at(dir_fd, target, S_IFREG);
21 if (r < 0)
22 return r;
23
24 r = fopen_temporary_at(dir_fd, path, f, temp_path);
25
26 mac_selinux_create_file_clear();
27
28 return r;
29 }