mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-03 01:17:45 +03:00
sysusers: add fsync for passwd (#24324)
https://github.com/systemd/systemd/pull/6636 added `fsync()` when temporary shadow, group, and gshadow files are created, but it was not added for passwd. As far as I can tell, this seems to have been an oversight. I'm seeing real world issues where a blank /etc/passwd file is being created if a machine loses power early in the boot process. (cherry picked from commit19193b4898
) (cherry picked from commit9f2f391153
)
This commit is contained in:
parent
c3fcff5291
commit
7ca021b87e
@ -509,7 +509,7 @@ static int write_temporary_passwd(const char *passwd_path, FILE **tmpfile, char
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = fflush_and_check(passwd);
|
r = fflush_sync_and_check(passwd);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_debug_errno(r, "Failed to flush %s: %m", passwd_tmp);
|
return log_debug_errno(r, "Failed to flush %s: %m", passwd_tmp);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user