_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();
if (r < 0)
goto finish;
_cleanup_fclose_ FILE *original = NULL;
passwd_path = fix_root("/etc/passwd");
- r = fopen_temporary(passwd_path, &passwd, &passwd_tmp);
+ r = label_context_set("/etc/passwd", S_IFREG);
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;
umask(0022);
+ label_init(NULL);
+
r = 0;
if (optind < argc) {