* src/useradd.c: Likewise for the default file, faillog, lastlog,
and mail spool.
This commit is contained in:
parent
5dd5f51700
commit
96c7b12bc4
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
* lib/commonio.c: Call fsync before closing the backup file. This
|
* lib/commonio.c: Call fsync before closing the backup file. This
|
||||||
ensures that the backup file is flushed to the storage medium.
|
ensures that the backup file is flushed to the storage medium.
|
||||||
|
* src/useradd.c: Likewise for the default file, faillog, lastlog,
|
||||||
|
and mail spool.
|
||||||
|
|
||||||
2009-03-15 Nicolas François <nicolas.francois@centraliens.net>
|
2009-03-15 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
|
@ -542,7 +542,9 @@ static int set_defaults (void)
|
|||||||
* the new file is intact.
|
* the new file is intact.
|
||||||
*/
|
*/
|
||||||
(void) fflush (ofp);
|
(void) fflush (ofp);
|
||||||
if ((ferror (ofp) != 0) || (fclose (ofp) != 0)) {
|
if ( (ferror (ofp) != 0)
|
||||||
|
|| (fsync (fileno (ofp)) != 0)
|
||||||
|
|| (fclose (ofp) != 0)) {
|
||||||
unlink (new_file);
|
unlink (new_file);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -1556,6 +1558,7 @@ static void faillog_reset (uid_t uid)
|
|||||||
if ( (-1 == fd)
|
if ( (-1 == fd)
|
||||||
|| (lseek (fd, offset_uid, SEEK_SET) != offset_uid)
|
|| (lseek (fd, offset_uid, SEEK_SET) != offset_uid)
|
||||||
|| (write (fd, &fl, sizeof (fl)) != (ssize_t) sizeof (fl))
|
|| (write (fd, &fl, sizeof (fl)) != (ssize_t) sizeof (fl))
|
||||||
|
|| (fsync (fd) != 0)
|
||||||
|| (close (fd) != 0)) {
|
|| (close (fd) != 0)) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: failed to reset the faillog entry of UID %lu: %s\n"),
|
_("%s: failed to reset the faillog entry of UID %lu: %s\n"),
|
||||||
@ -1581,6 +1584,7 @@ static void lastlog_reset (uid_t uid)
|
|||||||
if ( (-1 == fd)
|
if ( (-1 == fd)
|
||||||
|| (lseek (fd, offset_uid, SEEK_SET) != offset_uid)
|
|| (lseek (fd, offset_uid, SEEK_SET) != offset_uid)
|
||||||
|| (write (fd, &ll, sizeof (ll)) != (ssize_t) sizeof (ll))
|
|| (write (fd, &ll, sizeof (ll)) != (ssize_t) sizeof (ll))
|
||||||
|
|| (fsync (fd) != 0)
|
||||||
|| (close (fd) != 0)) {
|
|| (close (fd) != 0)) {
|
||||||
fprintf (stderr,
|
fprintf (stderr,
|
||||||
_("%s: failed to reset the lastlog entry of UID %lu: %s\n"),
|
_("%s: failed to reset the lastlog entry of UID %lu: %s\n"),
|
||||||
@ -1750,6 +1754,7 @@ static void create_mail (void)
|
|||||||
perror (_("Setting mailbox file permissions"));
|
perror (_("Setting mailbox file permissions"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fsync (fd);
|
||||||
close (fd);
|
close (fd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user