[Pkg-sysvinit-devel] Bug#58119: last -x shortcomings

Thomas Hood jdthood at yahoo.co.uk
Tue Jan 24 21:29:54 UTC 2006


I wrote:
> I.e., instead of the shutdown-to-shutdown time it would have the
> shutdown-to-reboot time.  Sounds reasonable.  I'd even call the current
> behavior buggy.

> The number in parentheses after "reboot" is the uptime.  It would be
> reasonable to fill in the second value.


OK, I have fixed these, I think.  Three-line change!

For:

    Jan 24 22:15    "last -x"s
    Jan 24 17:29    boot
    Jan 24 17:28    halt
    Jan 23 16:41    boot

The patch changes "last -x" output this way:

+reboot   system boot  2.6.15-9-686     Tue Jan 24 17:29 - 22:15  (04:45)
-reboot   system boot  2.6.15-9-686     Tue Jan 24 17:29          (04:45)

+shutdown system down  2.6.15-9-686     Tue Jan 24 17:28 - 17:29  (00:01)
-shutdown system down  2.6.15-9-686     Tue Jan 24 17:28 - 22:15  (04:46)

+reboot   system boot  2.6.15-9-686     Mon Jan 23 16:41 - 17:28 (1+00:47)
-reboot   system boot  2.6.15-9-686     Mon Jan 23 16:41         (1+00:47)


--- ./src/last.c        2005-12-02 17:22:57.000000000 +0100
+++ /tmp/dpep-work.bMPzBG/trunk/src/last.c      2006-01-24 22:12:35.000000000 +0100
@@ -418,7 +418,6 @@
                        sprintf(length, "- no logout");
                        break;
                case R_REBOOT:
-                       logouttime[0] = 0;      /* Print machine uptime */
                        break;
                case R_TIMECHANGE:
                        logouttime[0] = 0;
@@ -752,7 +751,7 @@
                case SHUTDOWN_TIME:
                        if (extended) {
                                strcpy(ut.ut_line, "system down");
-                               quit = list(&ut, lastdown, R_NORMAL);
+                               quit = list(&ut, lastboot, R_NORMAL);
                        }
                        lastdown = lastrch = ut.ut_time;
                        down = 1;
@@ -769,6 +768,7 @@
                case BOOT_TIME:
                        strcpy(ut.ut_line, "system boot");
                        quit = list(&ut, lastdown, R_REBOOT);
+                       lastboot = ut.ut_time;
                        down = 1;
                        break;
                case RUN_LVL:

-- 
Thomas




More information about the Pkg-sysvinit-devel mailing list