From: Ruediger Meier Date: Thu, 8 May 2014 17:01:03 +0000 (+0200) Subject: last: avoid leading "-" before "no logout" X-Git-Tag: v2.25-rc1~192 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e69f1ee0f3ee12bf544d0598b57af1fcff24a56;p=thirdparty%2Futil-linux.git last: avoid leading "-" before "no logout" This affects option --time-format=notime. Signed-off-by: Ruediger Meier --- diff --git a/login-utils/last.c b/login-utils/last.c index 3a802eda6d..ba58c44338 100644 --- a/login-utils/last.c +++ b/login-utils/last.c @@ -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: diff --git a/tests/expected/last/last b/tests/expected/last/last index 9dbee127a3..4172e8697a 100644 --- a/tests/expected/last/last +++ b/tests/expected/last/last @@ -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)