From 5331930716a091238465856232f6bfc5f8d03268 Mon Sep 17 00:00:00 2001 From: nekral-guest Date: Sat, 21 Mar 2009 19:25:02 +0000 Subject: [PATCH] * src/usermod.c: Likewise for the faillog and lastlog file. --- ChangeLog | 1 + src/usermod.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/ChangeLog b/ChangeLog index 71db50c3..ec308464 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ ensures that the backup file is flushed to the storage medium. * src/useradd.c: Likewise for the default file, faillog, lastlog, and mail spool. + * src/usermod.c: Likewise for the faillog and lastlog file. 2009-03-15 Nicolas François diff --git a/src/usermod.c b/src/usermod.c index 0162a95e..cb4d803a 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -1442,6 +1442,7 @@ static void update_lastlog (void) /* Copy the old entry to its new location */ if ( (lseek (fd, off_newuid, SEEK_SET) != off_newuid) || (write (fd, &ll, sizeof ll) != (ssize_t) sizeof ll) + || (fsync (fd) != 0) || (close (fd) != 0)) { fprintf (stderr, _("%s: failed to copy the lastlog entry of user %lu to user %lu: %s\n"), @@ -1458,6 +1459,7 @@ static void update_lastlog (void) memzero (&ll, sizeof (ll)); if ( (lseek (fd, off_newuid, SEEK_SET) != off_newuid) || (write (fd, &ll, sizeof ll) != (ssize_t) sizeof ll) + || (fsync (fd) != 0) || (close (fd) != 0)) { fprintf (stderr, _("%s: failed to copy the lastlog entry of user %lu to user %lu: %s\n"), @@ -1501,6 +1503,7 @@ static void update_faillog (void) /* Copy the old entry to its new location */ if ( (lseek (fd, off_newuid, SEEK_SET) != off_newuid) || (write (fd, &fl, sizeof fl) != (ssize_t) sizeof fl) + || (fsync (fd) != 0) || (close (fd) != 0)) { fprintf (stderr, _("%s: failed to copy the faillog entry of user %lu to user %lu: %s\n"),