[PATCH 09/16] last: make switch cases complete, and inform if impossible occurs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 login-utils/last.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/login-utils/last.c b/login-utils/last.c
index f188092..276d13a 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);
 		}
 
 		/*
-- 
1.8.3.4

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux