]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
last: fix --present option logic error
authorSami Kerola <kerolasa@iki.fi>
Tue, 27 Aug 2013 10:48:54 +0000 (11:48 +0100)
committerSami Kerola <kerolasa@iki.fi>
Thu, 29 Aug 2013 17:14:09 +0000 (18:14 +0100)
Printing of sessions 'still logged in' was skipped because an error in
logic.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
login-utils/last.c

index e5a9c243297dc2ba7cce44bb8e540c91f0779d2f..3cbfa069ddcdf617531a0bd986d918fe5bfc0586 100644 (file)
@@ -293,7 +293,7 @@ static int list(struct utmp *p, time_t t, int what, time_t present)
         */
        tmp = (time_t)p->ut_time;
 
-       if (present && (present < tmp || 0 == t || t < present))
+       if (present && (present < tmp || (0 < t && t < present)))
                return 0;
 
        strcpy(logintime, ctime(&tmp));