From a65c2c9b18db42d4004cc939bc706e749cc6f5a4 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Sat, 21 Mar 2009 19:28:02 +0000 Subject: [PATCH] * src/vipw.c: Likewise for the backup file. --- ChangeLog | 1 + src/vipw.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ec308464..6035b142 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ * src/useradd.c: Likewise for the default file, faillog, lastlog, and mail spool. * src/usermod.c: Likewise for the faillog and lastlog file. + * src/vipw.c: Likewise for the backup file. 2009-03-15 Nicolas François diff --git a/src/vipw.c b/src/vipw.c index 037808aa..f7d0e63f 100644 --- a/src/vipw.c +++ b/src/vipw.c @@ -112,7 +112,8 @@ static int create_backup_file (FILE * fp, const char *backup, struct stat *sb) unlink (backup); return -1; } - if (fclose (bkfp) != 0) { + if ( (fsync (fileno (bkfp)) != 0) + || (fclose (bkfp) != 0)) { unlink (backup); return -1; }