This source file includes following definitions.
- write_string_file_atomic_label
- write_env_file_label
- fopen_temporary_label
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "fileio-label.h"
#include "label.h"
#include "util.h"
int write_string_file_atomic_label(const char *fn, const char *line) {
int r;
r = mac_selinux_create_file_prepare(fn, S_IFREG);
if (r < 0)
return r;
r = write_string_file_atomic(fn, line);
mac_selinux_create_file_clear();
return r;
}
int write_env_file_label(const char *fname, char **l) {
int r;
r = mac_selinux_create_file_prepare(fname, S_IFREG);
if (r < 0)
return r;
r = write_env_file(fname, l);
mac_selinux_create_file_clear();
return r;
}
int fopen_temporary_label(const char *target,
const char *path, FILE **f, char **temp_path) {
int r;
r = mac_selinux_create_file_prepare(target, S_IFREG);
if (r < 0)
return r;
r = fopen_temporary(path, f, temp_path);
mac_selinux_create_file_clear();
return r;
}