Commit cad21b18 authored by Alan Coopersmith's avatar Alan Coopersmith Committed by Ray Strode

wtmp: fix wtmp file on solaris and netbsd

This commit moves detection of the location
of the wtmp file to configure and fixes that
detection to work on Solaris and NetBSD.

https://bugs.freedesktop.org/show_bug.cgi?id=90882
parent c0a7ac13
...@@ -185,9 +185,33 @@ fi ...@@ -185,9 +185,33 @@ fi
AC_SUBST(WARN_CFLAGS) AC_SUBST(WARN_CFLAGS)
AC_CHECK_HEADERS([shadow.h utmpx.h]) AC_CHECK_HEADERS([paths.h shadow.h utmpx.h])
AC_CHECK_FUNCS([fgetpwent]) AC_CHECK_FUNCS([fgetpwent setutxdb])
wtmpx_found="no"
AC_CHECK_DECLS([WTMPX_FILENAME], [wtmpx_found="WTMPX_FILENAME"],
[], [AC_INCLUDES_DEFAULT
#include <utmpx.h>
])
if test "$wtmpx_found" = "no" ; then
AC_CHECK_DECLS([_PATH_WTMPX], [wtmpx_found="_PATH_WTMPX"],
[], [AC_INCLUDES_DEFAULT
#ifdef HAVE_PATHS_H
#include <paths.h>
#endif
#ifdef HAVE_UTMPX_H
#include <utmpx.h>
#endif
])
if test "$wtmpx_found" = "no" ; then
AC_CHECK_FILE([/var/log/utx.log], [wtmpx_found='"/var/log/utx.log"'])
if test "$wtmpx_found" = "no" ; then
AC_MSG_FAILURE([Do not know which filename to watch for wtmp changes])
fi
fi
fi
AC_DEFINE_UNQUOTED([PATH_WTMP], [$wtmpx_found], [Path to wtmpx file])
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
dnl - gtk-doc Documentation dnl - gtk-doc Documentation
......
...@@ -56,12 +56,12 @@ user_previous_login_free (UserPreviousLogin *previous_login) ...@@ -56,12 +56,12 @@ user_previous_login_free (UserPreviousLogin *previous_login)
static gboolean static gboolean
wtmp_helper_start (void) wtmp_helper_start (void)
{ {
#if defined(UTXDB_LOG) #if defined(HAVE_SETUTXDB)
if (setutxdb (UTXDB_LOG, NULL) != 0) { if (setutxdb (UTXDB_LOG, NULL) != 0) {
return FALSE; return FALSE;
} }
#elif defined(WTMPX_FILENAME) #elif defined(PATH_WTMP)
if (utmpxname (WTMPX_FILENAME) != 0) { if (utmpxname (PATH_WTMP) != 0) {
return FALSE; return FALSE;
} }
...@@ -212,13 +212,7 @@ wtmp_helper_entry_generator (GHashTable *users, ...@@ -212,13 +212,7 @@ wtmp_helper_entry_generator (GHashTable *users,
const gchar * const gchar *
wtmp_helper_get_path_for_monitor (void) wtmp_helper_get_path_for_monitor (void)
{ {
#if defined(WTMPX_FILENAME) return PATH_WTMP;
return WTMPX_FILENAME;
#elif defined(__FreeBSD__)
return "/var/log/utx.log";
#else
#error Do not know which filename to watch for wtmp changes
#endif
} }
#else /* HAVE_UTMPX_H */ #else /* HAVE_UTMPX_H */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment