blob: 77c44ca9b929007d85f7b28aa8060567467b50b8 (
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
|
$NetBSD: patch-aa,v 1.1.1.1 2007/11/28 11:45:34 mjl Exp $
--- src/os_unix.c.orig 2007-11-28 11:58:20.000000000 +0100
+++ src/os_unix.c 2007-11-28 12:13:49.000000000 +0100
@@ -17,6 +17,12 @@
#include <ctype.h>
#endif
+#ifndef MAXINT
+#include <limits.h>
+#include <utmpx.h>
+#define MAXINT INT_MAX
+#endif
+
static int console_idle (time_t now, struct utmp *u)
{
struct stat sbuf;
@@ -43,7 +49,7 @@
*/
UDWORD os_DetermineIdleTime (time_t now, time_t last)
{
- struct utmp *u;
+ struct utmpx *u;
struct passwd *pass;
uid_t uid;
int tmp, min = MAXINT;
@@ -54,9 +60,8 @@
if (!pass)
return -1;
- utmpname (UTMP_FILE);
- setutent();
- while ((u = getutent()))
+ setutxent();
+ while ((u = getutxent()))
{
if (u->ut_type != USER_PROCESS)
continue;
@@ -67,7 +72,7 @@
tmp = console_idle (now, u);
min = (tmp < min) ? tmp : min ;
}
- endutent();
+ endutxent();
if (min == MAXINT || now - last < min)
min = now - last;
return min;
|