summaryrefslogtreecommitdiffstats
path: root/login-utils/last.c
diff options
context:
space:
mode:
authorSami Kerola2013-08-17 20:15:14 +0200
committerKarel Zak2013-08-23 10:58:57 +0200
commit5cae90f9d13d89e340a88a428411b2fc1eb29272 (patch)
tree6fe527bc2c2fc98048c6f52c603d1eedea2575a1 /login-utils/last.c
parentlast: check expected numeric user input is number (diff)
downloadkernel-qcow2-util-linux-5cae90f9d13d89e340a88a428411b2fc1eb29272.tar.gz
kernel-qcow2-util-linux-5cae90f9d13d89e340a88a428411b2fc1eb29272.tar.xz
kernel-qcow2-util-linux-5cae90f9d13d89e340a88a428411b2fc1eb29272.zip
last: make switch cases complete, and inform if impossible occurs
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>
Diffstat (limited to 'login-utils/last.c')
-rw-r--r--login-utils/last.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/login-utils/last.c b/login-utils/last.c
index f188092c8..276d13abd 100644
--- a/login-utils/last.c
+++ b/login-utils/last.c
@@ -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);
}
/*