From 171b5b95537d583c86570cab90a397c555bbf272 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 5 Dec 2009 20:26:55 +0000 Subject: Let init(8) and reboot(8) use utmpx to log wtmp entries. logwtmp() gets called with the raw strings that are written to disk. For regular user entries, this isn't too bad, but when booting/shutting down, the contents get rather cryptic. Just call the standardized pututxline(). --- sbin/reboot/reboot.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'sbin/reboot/reboot.c') diff --git a/sbin/reboot/reboot.c b/sbin/reboot/reboot.c index cae709f..0a9ac51 100644 --- a/sbin/reboot/reboot.c +++ b/sbin/reboot/reboot.c @@ -42,18 +42,20 @@ static char sccsid[] = "@(#)reboot.c 8.1 (Berkeley) 6/5/93"; __FBSDID("$FreeBSD$"); #include +#include #include #include #include #include #include #include -#include #include #include #include #include #include +#define _ULOG_POSIX_NAMES +#include #include static void usage(void); @@ -64,6 +66,7 @@ int dohalt; int main(int argc, char *argv[]) { + struct utmpx utx; const struct passwd *pw; int ch, howto, i, fd, lflag, nflag, qflag, sverrno; u_int pageins; @@ -140,7 +143,9 @@ main(int argc, char *argv[]) syslog(LOG_CRIT, "rebooted by %s", user); } } - logwtmp("~", "shutdown", ""); + utx.ut_type = SHUTDOWN_TIME; + gettimeofday(&utx.ut_tv, NULL); + pututxline(&utx); /* * Do a sync early on, so disks start transfers while we're off -- cgit v1.1