Skip to content

Commit

Permalink
useradd: fix write_full() return value
Browse files Browse the repository at this point in the history
write_full() returns -1 on error and useradd was checking another value.

Closes: #1072
Fixes: f45498a ("libmisc/write_full.c: Improve write_full()")

Reported-by: <https://github.com/brown-midas>
Suggested-by: <https://github.com/brown-midas>
Reviewed-by: Alejandro Colomar <alx@kernel.org>
Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
  • Loading branch information
ikerexxe committed Sep 13, 2024
1 parent 1f11a5c commit 5feaeff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/useradd.c
Original file line number Diff line number Diff line change
Expand Up @@ -2042,7 +2042,7 @@ static void lastlog_reset (uid_t uid)
return;
}
if ( (lseek (fd, offset_uid, SEEK_SET) != offset_uid)
|| (write_full (fd, &ll, sizeof (ll)) != (ssize_t) sizeof (ll))
|| (write_full (fd, &ll, sizeof (ll)) != -1)
|| (fsync (fd) != 0)) {
fprintf (stderr,
_("%s: failed to reset the lastlog entry of UID %lu: %s\n"),
Expand Down

0 comments on commit 5feaeff

Please sign in to comment.