diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2025-10-23 11:22:28 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2025-11-08 07:42:34 +0100 |
| commit | 782e3fc2b4012958d43e964064fd2f2806d46106 (patch) | |
| tree | b0dbb0b11d5d476f46ab8392f1e271f41feb55c4 | |
| parent | b99a529177b4adbe3b3f5a86f46b9cf386d4cbe4 (diff) | |
last: fix ignoring the first login entry
The first login entry is ignored if a log file contains more than one
entry. To fix it, do not break the while loop if the offset is zero.
Signed-off-by: Dmitry Klochkov <dmitry.klochkov@bell-sw.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | util-linux/last.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/util-linux/last.c b/util-linux/last.c index 7530d013d..aafd01bb9 100644 --- a/util-linux/last.c +++ b/util-linux/last.c @@ -157,7 +157,7 @@ int last_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) ut.ut_user, ut.ut_line, ut.ut_host, ctime(&t_tmp) + 4); next: pos -= sizeof(ut); - if (pos <= 0) + if (pos < 0) break; /* done. */ xlseek(file, pos, SEEK_SET); } |
