blob: 6ed93355bbfd538481d658d48c3a25d22c4428ce [file] [log] [blame]
Brad Bishop6e60e8b2018-02-01 10:27:11 -05001diff -Naur libutempter-1.1.6.orig/utempter.c libutempter-1.1.6/utempter.c
2--- libutempter-1.1.6.orig/utempter.c 2010-11-04 13:14:53.000000000 -0400
3+++ libutempter-1.1.6/utempter.c 2014-06-20 16:37:09.762403323 -0400
4@@ -34,13 +34,7 @@
5 #include <sys/stat.h>
6 #include <utmp.h>
7
8-#ifdef __GLIBC__
9 # include <pty.h>
10-#elif defined(__FreeBSD__)
11-# include <libutil.h>
12-#else
13-# error Unsupported platform
14-#endif /* __GLIBC__ || __FreeBSD__ */
15
16 #define DEV_PREFIX "/dev/"
17 #define DEV_PREFIX_LEN (sizeof(DEV_PREFIX)-1)
18@@ -106,17 +100,12 @@
19
20 static int
21 write_uwtmp_record(const char *user, const char *term, const char *host,
22-#ifdef __GLIBC__
23 pid_t pid,
24-#endif
25 int add)
26 {
27 struct utmp ut;
28 struct timeval tv;
29-
30-#ifdef __GLIBC__
31 size_t offset;
32-#endif
33
34 memset(&ut, 0, sizeof(ut));
35
36@@ -128,8 +117,6 @@
37 if (host)
38 strncpy(ut.ut_host, host, sizeof(ut.ut_host));
39
40-#ifdef __GLIBC__
41-
42 offset = (strlen(term) <= sizeof(ut.ut_id)) ? 0 :
43 strlen(term) - sizeof(ut.ut_id);
44 strncpy(ut.ut_id, term + offset, sizeof(ut.ut_id));
45@@ -156,27 +143,6 @@
46
47 (void) updwtmp(_PATH_WTMP, &ut);
48
49-#elif defined(__FreeBSD__)
50-
51- ut.ut_time = tv.tv_sec;
52-
53- if (add)
54- {
55- login(&ut);
56- } else
57- {
58- if (logout(term) != 1)
59- {
60-#ifdef UTEMPTER_DEBUG
61- fprintf(stderr, "utempter: logout: %s\n",
62- strerror(errno));
63-#endif
64- exit(EXIT_FAILURE);
65- }
66- }
67-
68-#endif /* __GLIBC__ || __FreeBSD__ */
69-
70 #ifdef UTEMPTER_DEBUG
71 fprintf(stderr,
72 "utempter: DEBUG: utmp/wtmp record %s for terminal '%s'\n",
73@@ -255,8 +221,6 @@
74 validate_device(device);
75
76 return write_uwtmp_record(pw->pw_name, device + DEV_PREFIX_LEN, host,
77-#ifdef __GLIBC__
78 pid,
79-#endif
80 add);
81 }