svn commit: r201695 - user/ed/utmpx/lib/libc/gen
Ed Schouten
ed at FreeBSD.org
Wed Jan 6 23:36:15 UTC 2010
Author: ed
Date: Wed Jan 6 23:36:14 2010
New Revision: 201695
URL: http://svn.freebsd.org/changeset/base/201695
Log:
Truncate utx.active when (re)booting.
This makes sure utmp entries never survive a reboot.
Modified:
user/ed/utmpx/lib/libc/gen/pututxline.c
Modified: user/ed/utmpx/lib/libc/gen/pututxline.c
==============================================================================
--- user/ed/utmpx/lib/libc/gen/pututxline.c Wed Jan 6 23:34:53 2010 (r201694)
+++ user/ed/utmpx/lib/libc/gen/pututxline.c Wed Jan 6 23:36:14 2010 (r201695)
@@ -181,6 +181,13 @@ utx_active_remove(struct futx *fu)
}
static void
+utx_active_purge(void)
+{
+
+ truncate(_PATH_UTX_ACTIVE, 0);
+}
+
+static void
utx_lastlogin_add(const struct futx *fu)
{
int fd;
@@ -253,9 +260,11 @@ pututxline(const struct utmpx *utmpx)
switch (fu.fu_type) {
case BOOT_TIME:
+ case SHUTDOWN_TIME:
+ utx_active_purge();
+ break;
case OLD_TIME:
case NEW_TIME:
- case SHUTDOWN_TIME:
break;
case USER_PROCESS:
utx_active_add(&fu);
More information about the svn-src-user
mailing list