blob: ec1ce8ce6b0ab52e27f80f39249355fa4d952ba1 (
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
|
--- oobs/oobs-user.c.orig 2007-10-30 09:16:53.406333206 -0400
+++ oobs/oobs-user.c 2007-10-30 09:40:02.560797530 -0400
@@ -18,13 +18,28 @@
* Authors: Carlos Garnacho Parro <carlosg@gnome.org>
*/
+#if defined(HAVE_CONFIG_H)
+#include <config.h>
+#endif
+
+#ifdef __FreeBSD__
+# include <sys/param.h>
+# if __FreeBSD_version >= 900007
+# define HAVE_UTMPX_H
+# endif
+#endif
+
#include <glib-object.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+#ifdef HAVE_CRYPT_H
#include <crypt.h>
-#include <utmp.h>
+#endif
+#ifdef HAVE_UTMPX_H
+#include <utmpx.h>
+#endif
#include "oobs-usersconfig.h"
#include "oobs-user.h"
@@ -811,7 +826,8 @@
gboolean
oobs_user_get_active (OobsUser *user)
{
- struct utmp *entry;
+#ifdef HAVE_UTMPX_H
+ struct utmpx *entry;
const gchar *login;
gboolean match = FALSE;
@@ -819,14 +835,18 @@
login = oobs_user_get_login_name (user);
- while (!match && (entry = getutent ()) != NULL)
+ setutxent ();
+ while (!match && (entry = getutxent ()) != NULL)
{
match = (entry->ut_type == USER_PROCESS &&
strcmp (entry->ut_user, login) == 0);
}
/* close utmp */
- endutent ();
+ endutxent ();
return match;
+#else
+ return FALSE;
+#endif
}
|