chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add function to open temp files in selinux mode
[elogind.git]
/
src
/
sysusers
/
sysusers.c
diff --git
a/src/sysusers/sysusers.c
b/src/sysusers/sysusers.c
index e086c72682c39a847363fe41e185ed6753f95e83..d679394dfad7e6bb790747a08dc9289f0c29cd52 100644
(file)
--- a/
src/sysusers/sysusers.c
+++ b/
src/sysusers/sysusers.c
@@
-35,6
+35,8
@@
#include "conf-files.h"
#include "copy.h"
#include "utf8.h"
#include "conf-files.h"
#include "copy.h"
#include "utf8.h"
+#include "label.h"
+#include "fileio-label.h"
typedef enum ItemType {
ADD_USER = 'u',
typedef enum ItemType {
ADD_USER = 'u',
@@
-312,11
+314,7
@@
static int write_files(void) {
_cleanup_fclose_ FILE *original = NULL;
group_path = fix_root("/etc/group");
_cleanup_fclose_ FILE *original = NULL;
group_path = fix_root("/etc/group");
- r = label_context_set("/etc/group", S_IFREG);
- if (r < 0)
- goto finish;
- r = fopen_temporary(group_path, &group, &group_tmp);
- label_context_clear();
+ r = fopen_temporary_label("/etc/group", group_path, &group, &group_tmp);
if (r < 0)
goto finish;
if (r < 0)
goto finish;
@@
-392,14
+390,9
@@
static int write_files(void) {
_cleanup_fclose_ FILE *original = NULL;
passwd_path = fix_root("/etc/passwd");
_cleanup_fclose_ FILE *original = NULL;
passwd_path = fix_root("/etc/passwd");
- r =
label_context_set("/etc/passwd", S_IFREG
);
+ r =
fopen_temporary_label("/etc/passwd", passwd_path, &passwd, &passwd_tmp
);
if (r < 0)
goto finish;
if (r < 0)
goto finish;
- r = fopen_temporary(passwd_path, &passwd, &passwd_tmp);
- label_context_clear();
- if (r < 0) {
- goto finish;
- }
if (fchmod(fileno(passwd), 0644) < 0) {
r = -errno;
if (fchmod(fileno(passwd), 0644) < 0) {
r = -errno;