summaryrefslogtreecommitdiff
path: root/misc/screen/patches/patch-al
blob: df3a0ab1f5350fc17a9769f611e2c3b27c78ee44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$NetBSD: patch-al,v 1.3 2014/08/25 20:02:32 kim 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	2014-04-26 16:22:09.000000000 +0000
+++ utmp.c	2014-08-25 17:55:13.000000000 +0000
@@ -48,6 +48,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
@@ -315,6 +321,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;
@@ -379,6 +388,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);