summaryrefslogtreecommitdiff
path: root/x11/rxvt/patches/patch-ak
blob: 34880218c664d758bbc0e8c140a218140a6e3db0 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
$NetBSD: patch-ak,v 1.3 2012/07/09 19:06:22 joerg Exp $

--- src/logging.c.orig	2002-12-16 00:33:04.000000000 +0000
+++ src/logging.c
@@ -66,9 +66,7 @@ rxvt_makeutent(rxvt_t *r, const char *pt
 #ifdef HAVE_STRUCT_UTMPX
     struct utmpx   *utx = &(r->h->utx);
 #endif
-#ifdef HAVE_UTMP_PID
     int             i;
-#endif
     char            ut_id[5];
     struct passwd  *pwent = getpwuid(getuid());
 
@@ -78,10 +76,8 @@ rxvt_makeutent(rxvt_t *r, const char *pt
     if (!STRNCMP(pty, "pty", 3) || !STRNCMP(pty, "tty", 3)) {
 	STRNCPY(ut_id, (pty + 3), sizeof(ut_id));
     }
-#ifdef HAVE_UTMP_PID
     else if (sscanf(pty, "pts/%d", &i) == 1)
 	sprintf(ut_id, "vt%02x", (i & 0xff));	/* sysv naming */
-#endif
     else if (STRNCMP(pty, "pty", 3) && STRNCMP(pty, "tty", 3)) {
 	rxvt_print_error("can't parse tty name \"%s\"", pty);
 	return;
@@ -137,7 +133,9 @@ rxvt_makeutent(rxvt_t *r, const char *pt
     STRNCPY(utx->ut_user, (pwent && pwent->pw_name) ? pwent->pw_name : "?",
 	    sizeof(utx->ut_user));
     STRNCPY(utx->ut_id, ut_id, sizeof(utx->ut_id));
+# ifdef HAVE_UTMPX_SESSION
     utx->ut_session = getsid(0);
+# endif
     utx->ut_tv.tv_sec = time(NULL);
     utx->ut_tv.tv_usec = 0;
     utx->ut_pid = r->h->cmd_pid;
@@ -203,7 +201,11 @@ rxvt_makeutent(rxvt_t *r, const char *pt
 #  endif
 # endif
 # ifdef HAVE_STRUCT_UTMPX
+#  ifdef HAVE_UPDWTMPX
 	updwtmpx(RXVT_WTMPX_FILE, utx);
+#  else
+	pututxline(utx);
+#  endif
 # endif
     }
 #endif
@@ -254,7 +256,9 @@ rxvt_cleanutent(rxvt_t *r)
     if ((tmputx = getutxid(utx)))	/* position to entry in utmp file */
 	utx = tmputx;
     utx->ut_type = DEAD_PROCESS;
+# ifdef HAVE_UTMPX_SESSION
     utx->ut_session = getsid(0);
+# endif
     utx->ut_tv.tv_sec = time(NULL);
     utx->ut_tv.tv_usec = 0;
 #endif
@@ -275,7 +279,11 @@ rxvt_cleanutent(rxvt_t *r)
 #  endif
 # endif
 # ifdef HAVE_STRUCT_UTMPX
+#  ifdef HAVE_UPDWTMPX
 	updwtmpx(RXVT_WTMPX_FILE, utx);
+#  else
+	pututxline(utx);
+#  endif
 # endif
     }
 #endif
@@ -327,7 +335,7 @@ rxvt_write_bsd_utmp(int utmp_pos, struct
 /*
  * Update a BSD style wtmp entry
  */
-#if defined(WTMP_SUPPORT) && !defined(HAVE_UPDWTMP)
+#if defined(WTMP_SUPPORT) && !defined(HAVE_UPDWTMP) && defined(HAVE_STRUCT_UTMP)
 /* INTPROTO */
 void
 rxvt_update_wtmp(const char *fname, const struct utmp *putmp)