]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
last: make switch cases complete, and inform if impossible occurs
authorSami Kerola <kerolasa@iki.fi>
Sat, 17 Aug 2013 18:15:14 +0000 (19:15 +0100)
committerKarel Zak <kzak@redhat.com>
Fri, 23 Aug 2013 08:58:57 +0000 (10:58 +0200)
Some of the ut_type numbers does not seem to be recognized by last(1) so
they are, at least for now, silently ignored.  See glibc documentation
for information what the ignored EMPTY, INIT_PROCESS, LOGIN_PROCESS, and
ACCOUNTING mean.

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

index f188092c8e083969ef4980893617e0b0186fe51f..276d13abd56e78772f85b14423b1310b143d8f86 100644 (file)
@@ -343,6 +343,8 @@ static int list(struct utmp *p, time_t t, int what)
                        break;
                case R_NORMAL:
                        break;
+               default:
+                       abort();
        }
 
        /*
@@ -808,6 +810,15 @@ int main(int argc, char **argv)
                        utmplist = p;
                        break;
 
+               case EMPTY:
+               case INIT_PROCESS:
+               case LOGIN_PROCESS:
+               case ACCOUNTING:
+                       /* ignored ut_types */
+                       break;
+
+               default:
+                       warnx("unrecogized ut_type: %d", ut.ut_type);
                }
 
                /*