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; }