X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fshared%2Ffileio-label.c;h=f596f1d11fc6d54be479bfd8f13c35079c5cf857;hp=417ca5695a956e62455d3b15873e38fdabed9003;hb=ebbac6d948b9d323b3d57bfd7c3513776e591dc1;hpb=f7f628b5db770feb8b18990436baefaec55c460b diff --git a/src/shared/fileio-label.c b/src/shared/fileio-label.c index 417ca5695..f596f1d11 100644 --- a/src/shared/fileio-label.c +++ b/src/shared/fileio-label.c @@ -19,24 +19,21 @@ You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see . ***/ -#include -#include -#include -#include "fileio-label.h" -#include "label.h" #include "util.h" +#include "selinux-util.h" +#include "fileio-label.h" int write_string_file_atomic_label(const char *fn, const char *line) { int r; - r = label_context_set(fn, S_IFREG); + r = mac_selinux_create_file_prepare(fn, S_IFREG); if (r < 0) return r; - write_string_file_atomic(fn, line); + r = write_string_file(fn, line, WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC); - label_context_clear(); + mac_selinux_create_file_clear(); return r; } @@ -44,13 +41,13 @@ int write_string_file_atomic_label(const char *fn, const char *line) { int write_env_file_label(const char *fname, char **l) { int r; - r = label_context_set(fname, S_IFREG); + r = mac_selinux_create_file_prepare(fname, S_IFREG); if (r < 0) return r; - write_env_file(fname, l); + r = write_env_file(fname, l); - label_context_clear(); + mac_selinux_create_file_clear(); return r; } @@ -59,13 +56,13 @@ int fopen_temporary_label(const char *target, const char *path, FILE **f, char **temp_path) { int r; - r = label_context_set("/etc/passwd", S_IFREG); + r = mac_selinux_create_file_prepare(target, S_IFREG); if (r < 0) return r; r = fopen_temporary(path, f, temp_path); - label_context_clear(); + mac_selinux_create_file_clear(); return r; }