]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
last: avoid leading "-" before "no logout"
authorRuediger Meier <ruediger.meier@ga-group.nl>
Thu, 8 May 2014 17:01:03 +0000 (19:01 +0200)
committerRuediger Meier <ruediger.meier@ga-group.nl>
Sat, 10 May 2014 13:17:42 +0000 (15:17 +0200)
This affects option --time-format=notime.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
login-utils/last.c
tests/expected/last/last

index 3a802eda6d1dbfbe93d1d4dc7da14d4140bd97d4..ba58c4433831b44354649cd52ebc5d7513e2d1c7 100644 (file)
@@ -465,9 +465,12 @@ static int list(const struct last_control *ctl, struct utmp *p, time_t t, int wh
                        if (ctl->time_fmt > LAST_TIMEFTM_SHORT_CTIME) {
                                sprintf(logouttime, "  gone - no logout");
                                length[0] = 0;
-                       } else {
+                       } else if (ctl->time_fmt == LAST_TIMEFTM_SHORT_CTIME) {
                                sprintf(logouttime, "   gone");
                                sprintf(length, "- no logout");
+                       } else {
+                               logouttime[0] = 0;
+                               sprintf(length, "no logout");
                        }
                        break;
                case R_REBOOT:
index 9dbee127a3bf65990094231b12a998d1245afb8f..4172e8697a09e950c482dcf934e9fc71c8c17f32 100644 (file)
@@ -90,7 +90,7 @@ accounti foo          nine             Wed Aug 28 03:00:00 2013 - Wed Aug 28 04:
 wtmp begins Wed Aug 28 03:00:00 2013
 ~~~ no time ~~~
 rick     long         never-gonna-logo   (24855+03:14)
-torvalds linux        hobby              no logout
+torvalds linux        hobby              no logout
 reboot   system boot  system-name        running
 reboot   system boot  system-name         (01:00)
 IPv4     root         dns-server          (01:00)