Hey, I'm not sure if this is a general fix, but it fixes for me locally:

--- a/login-utils/last.c        (revision before change)
+++ b/login-utils/last.c        (revision with change)
@@ process_wtmp_file(...) switch statement:
-               case BOOT_TIME:
-                       strcpy(ut.ut_line, "system boot");
-                       quit = list(ctl, &ut, lastdown, R_REBOOT);
-                       lastboot = ut.ut_tv.tv_sec;
-                       down = 1;
-                       break;
+               case BOOT_TIME:
+                       strcpy(ut.ut_line, "system boot");
+                       /* If this boot record is older than a later boot event 
and no shutdown time has yet been recorded,
+                          skip printing it so that it doesn't erroneously show 
"still running". */
+                       if (lastboot != 0 && ut.ut_tv.tv_sec < lastboot && 
lastdown == currentdate)
+                               break;
+                       quit = list(ctl, &ut, lastdown, R_REBOOT);
+                       lastboot = ut.ut_tv.tv_sec;
+                       down = 1;
+                       break;

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1563025

Title:
  'last' command output is wrong

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1563025/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to