useradd reports spurious warning "failed to reset the lastlog entry"
Closed this issue · 1 comments
brown-midas commented
I've noticed that useradd
reports a spurious error if you create a system user, e.g.
useradd -r -u 111 testuser1
The user is still created correctly.
In the code for useradd (line 2044) I see:
if ( (lseek (fd, offset_uid, SEEK_SET) != offset_uid)
|| (write_full (fd, &ll, sizeof (ll)) != (ssize_t) sizeof (ll))
|| (fsync (fd) != 0)) {
But write_full() returns zero on success, -1 on error, so it should be:
if ( (lseek (fd, offset_uid, SEEK_SET) != offset_uid)
|| (write_full (fd, &ll, sizeof (ll)) == -1)
|| (fsync (fd) != 0)) {
ikerexxe commented
You are right. Let me prepare a patch to fix this issue.