8af6a397e4
large login and idle times. This was due to a bug in utmp.c: in os.h ------- # define utmp utmpx # define ut_time ut_xtime in utmp.c::makeuser() --------------------- struct utmp *u; (void)time((time_t *)&u->ut_time); The above works fine on i386 where ut_xtime and time_t are the same size, but on sparc64 ut_xtime is 8 bytes rather than 4. This fix was tested on i386 and sparc64.
59 lines
1.5 KiB
Text
59 lines
1.5 KiB
Text
$NetBSD: patch-al,v 1.2 2003/12/01 15:18:27 ben Exp $
|
|
|
|
Make extra calls to remove utmp entries when utmpx is used.
|
|
For non-login entries we only update utmpx, as it stores
|
|
more information, and utilities are reading both.
|
|
|
|
--- utmp.c.orig Tue Jan 8 10:44:37 2002
|
|
+++ utmp.c Sun Sep 15 02:36:15 2002
|
|
@@ -47,6 +47,12 @@
|
|
extern int real_uid, eff_uid;
|
|
|
|
|
|
+#ifdef NetBSD_UTMP
|
|
+extern void utmp_login __P((char *));
|
|
+extern void utmp_logout __P((char *));
|
|
+#endif
|
|
+
|
|
+
|
|
/*
|
|
* UTNOKEEP: A (ugly) hack for apollo that does two things:
|
|
* 1) Always close and reopen the utmp file descriptor. (I don't know
|
|
@@ -314,6 +320,9 @@
|
|
|
|
ASSERT(display);
|
|
debug("RemoveLoginSlot: removing your logintty\n");
|
|
+#ifdef NetBSD_UTMP
|
|
+ utmp_logout(stripdev(D_usertty));
|
|
+#endif
|
|
D_loginslot = TtyNameSlot(D_usertty);
|
|
if (D_loginslot == (slot_t)0 || D_loginslot == (slot_t)-1)
|
|
return;
|
|
@@ -378,6 +387,9 @@
|
|
|
|
debug("RestoreLoginSlot()\n");
|
|
ASSERT(display);
|
|
+#ifdef NetBSD_UTMP
|
|
+ utmp_login(stripdev(D_usertty));
|
|
+#endif
|
|
if (utmpok && D_loginslot != (slot_t)0 && D_loginslot != (slot_t)-1)
|
|
{
|
|
debug1(" logging you in again (slot %#x)\n", (int)D_loginslot);
|
|
@@ -604,6 +616,7 @@
|
|
char *line, *user;
|
|
int pid;
|
|
{
|
|
+ time_t temp;
|
|
u->ut_type = USER_PROCESS;
|
|
strncpy(u->ut_user, user, sizeof(u->ut_user));
|
|
/* Now the tricky part... guess ut_id */
|
|
@@ -618,7 +631,8 @@
|
|
#endif /* sgi */
|
|
strncpy(u->ut_line, line, sizeof(u->ut_line));
|
|
u->ut_pid = pid;
|
|
- (void)time((time_t *)&u->ut_time);
|
|
+ (void)time(&temp);
|
|
+ u->ut_time = temp;
|
|
}
|
|
|
|
static slot_t
|