2016-11-18 22:39:22 +01:00

42 lines
1.2 KiB
Plaintext

$NetBSD: patch-al,v 1.6 2016/06/20 16:04:44 ryoon 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 2016-06-19 19:41:03.000000000 +0000
+++ utmp.c
@@ -48,6 +48,12 @@ extern char *LoginName;
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
@@ -315,6 +321,9 @@ RemoveLoginSlot()
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;
@@ -379,6 +388,9 @@ RestoreLoginSlot()
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);