62 lines
1.4 KiB
Text
62 lines
1.4 KiB
Text
$NetBSD: patch-ac,v 1.3 2009/07/12 10:33:12 hasso Exp $
|
|
|
|
--- oobs/oobs-user.c.orig 2008-01-02 16:23:56 +0200
|
|
+++ oobs/oobs-user.c 2009-07-12 10:44:15 +0300
|
|
@@ -18,13 +18,29 @@
|
|
* Authors: Carlos Garnacho Parro <carlosg@gnome.org>
|
|
*/
|
|
|
|
+#if defined(HAVE_CONFIG_H)
|
|
+#include <config.h>
|
|
+#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>
|
|
+#endif
|
|
+#ifndef __NetBSD__
|
|
#include <utmp.h>
|
|
+#define UTMP utmp
|
|
+#define GETUTENT getutent
|
|
+#define ENDUTENT endutent
|
|
+#else
|
|
+#include <utmpx.h>
|
|
+#define UTMP utmpx
|
|
+#define GETUTENT getutxent
|
|
+#define ENDUTENT endutxent
|
|
+#endif
|
|
|
|
#include "oobs-usersconfig.h"
|
|
#include "oobs-user.h"
|
|
@@ -804,7 +820,7 @@ oobs_user_set_other_data (OobsUser *user
|
|
gboolean
|
|
oobs_user_get_active (OobsUser *user)
|
|
{
|
|
- struct utmp *entry;
|
|
+ struct UTMP *entry;
|
|
const gchar *login;
|
|
gboolean match = FALSE;
|
|
|
|
@@ -812,14 +828,16 @@ oobs_user_get_active (OobsUser *user)
|
|
|
|
login = oobs_user_get_login_name (user);
|
|
|
|
- while (!match && (entry = getutent ()) != NULL)
|
|
+#if !defined(__FreeBSD__) && !defined(__DragonFly__)
|
|
+ while (!match && (entry = GETUTENT ()) != NULL)
|
|
{
|
|
match = (entry->ut_type == USER_PROCESS &&
|
|
strcmp (entry->ut_user, login) == 0);
|
|
}
|
|
|
|
/* close utmp */
|
|
- endutent ();
|
|
+ ENDUTENT ();
|
|
|
|
return match;
|
|
+#endif
|
|
}
|