summaryrefslogtreecommitdiff
path: root/debian/patches/0015-utmp.c.patch
blob: 70e2a232ef4a7ce91d9f6a8582b8ac4ed4c2ccdf (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
From: Shadow package maintainers <pkg-shadow-devel@lists.alioth.debian.org>
Date: Mon, 4 Jun 2012 01:37:48 +0000
Subject: utmp.c

===================================================================
---
 libmisc/utmp.c |   17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/libmisc/utmp.c b/libmisc/utmp.c
index 437c3d5..8bb70ce 100644
--- a/libmisc/utmp.c
+++ b/libmisc/utmp.c
@@ -32,15 +32,19 @@
 
 #include <config.h>
 
-#include "defines.h"
-#include "prototypes.h"
-
-#include <utmp.h>
 
 #ifdef USE_UTMPX
 #include <utmpx.h>
+#define utmp utmpx
+#define updwtmp updwtmpx
+#define pututline pututxline
+#else
+#include <utmp.h>
 #endif
 
+#include "defines.h"
+#include "prototypes.h"
+
 #include <assert.h>
 #include <netdb.h>
 #include <stdio.h>
@@ -281,6 +285,10 @@ static void updwtmpx (const char *filename, const struct utmpx *utx)
 	/* ut_exit is only for DEAD_PROCESS */
 	utent->ut_session = getsid (0);
 	if (gettimeofday (&tv, NULL) == 0) {
+#ifdef USE_UTMPX
+		utent->ut_tv.tv_sec  = tv.tv_sec;
+		utent->ut_tv.tv_usec = tv.tv_usec;
+#else
 #ifdef HAVE_STRUCT_UTMP_UT_TIME
 		utent->ut_time = tv.tv_sec;
 #endif				/* HAVE_STRUCT_UTMP_UT_TIME */
@@ -291,6 +299,7 @@ static void updwtmpx (const char *filename, const struct utmpx *utx)
 		utent->ut_tv.tv_sec  = tv.tv_sec;
 		utent->ut_tv.tv_usec = tv.tv_usec;
 #endif				/* HAVE_STRUCT_UTMP_UT_TV */
+#endif
 	}
 
 	return utent;