#! /bin/sh /usr/share/dpatch/dpatch-run ## 25_last_sanify.dpatch by Thomas Hood ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: In "last -x" output: ## DP: + On "reboot" line print endpoint of uptime too ## DP: + On "shutdown" line print downtime rather that time between downs ## DP: (Closes: #58119) @DPATCH@ diff -urNad --exclude=CVS --exclude=.svn ./src/last.c /tmp/dpep-work.yygu5p/trunk/src/last.c --- ./src/last.c 2005-12-02 17:22:57.000000000 +0100 +++ /tmp/dpep-work.yygu5p/trunk/src/last.c 2006-02-19 22:35:31.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; @@ -717,7 +716,7 @@ ut.ut_type = SHUTDOWN_TIME; else if (strncmp(ut.ut_user, "reboot", 6) == 0) ut.ut_type = BOOT_TIME; - else if (strncmp(ut.ut_user, "runlevel", 7) == 0) + else if (strncmp(ut.ut_user, "runlevel", 8) == 0) ut.ut_type = RUN_LVL; } #if 1 /*def COMPAT*/ @@ -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: