aboutsummaryrefslogtreecommitdiff
path: root/sysutils/runit/files/patch-utmpx
blob: 6b82109f1d914aa0a869bcb918caf73a015fcc0f (plain) (blame)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
$FreeBSD$

Since init lacks this code in FreeBSD (utx-logout is performed in pam_lastlog)
we will simply make utmpset.c a noop if utmpx is present.

http://lists.freebsd.org/pipermail/freebsd-ports/2011-May/067872.html

diff -ruN ../runit-2.0.0.orig/src/tryuwtmpx.c ./src/tryuwtmpx.c
--- ../runit-2.0.0.orig/src/tryuwtmpx.c	2008-06-15 21:53:26.000000000 +0100
+++ ./src/tryuwtmpx.c	2011-05-21 21:47:36.834727936 +0100
@@ -1,9 +1,9 @@
 #include <sys/types.h>
 #include <utmpx.h>
 
-struct futmpx ut;
+struct utmpx ut;
 
 int main(void) {
-  char *s =ut.ut_name;
+  char *s =ut.ut_user;
   return(0);
 }
diff -ruN ../runit-2.0.0.orig/src/utmpset.c ./src/utmpset.c
--- ../runit-2.0.0.orig/src/utmpset.c	2008-06-15 21:53:26.000000000 +0100
+++ ./src/utmpset.c	2011-05-24 19:11:50.186633061 +0100
@@ -22,6 +22,11 @@
 void usage(void) { strerr_die4x(1, "usage: ", progname, USAGE, "\n"); }
 
 int utmp_logout(const char *line) {
+
+#ifdef _UW_TMP_UTMPX
+  int ok = 1; /* do_nada(); */
+#else /* _UW_TMP_UTMP */
+
   int fd;
   uw_tmp ut;
   int ok =-1;
@@ -45,9 +50,13 @@
     break;
   }
   close(fd);
+#endif /* _UW_TMP_UTMPX */
   return(ok);
 }
 int wtmp_logout(const char *line) {
+#ifdef _UW_TMP_UTMPX
+  return 1; /* do_nada(); */
+#else /* _UW_TMP_UTMP */
   int fd;
   int len;
   struct stat st;
@@ -79,6 +88,7 @@
   }
   close(fd);
   return(1);
+#endif /* _UW_TMP_UTMPX */
 }
 
 int main (int argc, const char * const *argv, const char * const *envp) {
diff -ruN ../runit-2.0.0.orig/src/uw_tmp.h1 ./src/uw_tmp.h1
--- ../runit-2.0.0.orig/src/uw_tmp.h1	2008-06-15 21:53:26.000000000 +0100
+++ ./src/uw_tmp.h1	2011-05-24 19:12:55.575957224 +0100
@@ -3,6 +3,8 @@
 
 /* sysdep: -utmpx */
 
+#ifndef _UW_TMP_UTMP
+#define _UW_TMP_UTMP
 #ifdef _PATH_UTMP
 #define UW_TMP_UFILE _PATH_UTMP
 #define UW_TMP_WFILE _PATH_WTMP
@@ -17,3 +19,4 @@
 #endif
 
 typedef struct utmp uw_tmp;
+#endif /* _UW_TMP_UTMP */
diff -ruN ../runit-2.0.0.orig/src/uw_tmp.h2 ./src/uw_tmp.h2
--- ../runit-2.0.0.orig/src/uw_tmp.h2	2008-06-15 21:53:26.000000000 +0100
+++ ./src/uw_tmp.h2	2011-05-24 19:13:16.542222974 +0100
@@ -3,11 +3,12 @@
 
 /* sysdep: +utmpx */
 
-#define UW_TMP_UFILE _UTMPX_FILE
-#define UW_TMP_WFILE _WTMPX_FILE
-
+#ifndef _UW_TMP_UTMPX
+#define _UW_TMP_UTMPX
 #ifndef ut_time
 #define ut_time ut_tv.tv_sec
 #endif
 
-typedef struct futmpx uw_tmp;
+typedef struct utmpx uw_tmp;
+
+#endif /* _UW_TMP_UTMPX */