summaryrefslogtreecommitdiff
path: root/src/sysusers
diff options
context:
space:
mode:
authorAvram Lubkin <avylove@rockhopper.net>2022-08-16 08:51:21 -0400
committerGitHub <noreply@github.com>2022-08-16 21:51:21 +0900
commit19193b489841a7bcccda7122ac0849cf6efe59fd (patch)
tree2b2f522c9e4f677bf8b88b951615542be8b3f9c5 /src/sysusers
parent73096907881fcdaba27c128d46a55e6b9ce3cc5e (diff)
downloadsystemd-19193b489841a7bcccda7122ac0849cf6efe59fd.tar.gz
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.
Diffstat (limited to 'src/sysusers')
-rw-r--r--src/sysusers/sysusers.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c
index dfb703f10e..9c1abf984e 100644
--- a/src/sysusers/sysusers.c
+++ b/src/sysusers/sysusers.c
@@ -507,7 +507,7 @@ static int write_temporary_passwd(const char *passwd_path, FILE **tmpfile, char
break;
}
- r = fflush_and_check(passwd);
+ r = fflush_sync_and_check(passwd);
if (r < 0)
return log_debug_errno(r, "Failed to flush %s: %m", passwd_tmp);