aboutsummaryrefslogtreecommitdiff
path: root/src/utmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/utmp.c')
-rw-r--r--src/utmp.c41
1 files changed, 32 insertions, 9 deletions
diff --git a/src/utmp.c b/src/utmp.c
index 4a1e746..8045370 100644
--- a/src/utmp.c
+++ b/src/utmp.c
@@ -26,10 +26,6 @@ typedef struct utmpx UTMPX;
# define pies_updwtmpx updwtmpx
# endif
# define GETUTXID getutxid
-# undef UTMP_FILE
-# define UTMP_FILE UTMPX_FILE
-# undef WTMP_FILE
-# define WTMP_FILE WTMPX_FILE
# if defined HAVE_STRUCT_UTMPX_UT_NAME
# define UT_NAME(u) ((u)->ut_name)
# elif defined HAVE_STRUCT_UTMPX_UT_USER
@@ -52,6 +48,33 @@ typedef struct utmp UTMPX;
# define endutxent endutent
#endif
+#if !defined(UTMPX_FILE) || !defined(WTMPX_FILE)
+# if !defined(UTMP_FILE) || !defined(WTMP_FILE)
+# ifndef HAVE_UTMPX_H
+# include <utmp.h>
+# endif
+# if !defined(UTMP_FILE)
+# if !defined(_PATH_UTMP)
+# error "None of UTMPX_FILE, UTMP_FILE or _PATH_UTMP defined"
+# else
+# define UTMP_FILE _PATH_UTMP
+# endif
+# endif
+# if !defined(WTMP_FILE)
+# if !defined(_PATH_WTMP)
+# error "None of WTMPX_FILE, WTMP_FILE or _PATH_WTMP defined"
+# else
+# define WTMP_FILE _PATH_WTMP
+# endif
+# endif
+# endif
+# if !defined(UTMPX_FILE)
+# define UTMPX_FILE UTMP_FILE
+# endif
+# if !defined(WTMPX_FILE)
+# define WTMPX_FILE WTMP_FILE
+# endif
+#endif
#ifndef pies_updwtmpx
static void
@@ -111,8 +134,8 @@ write_wtmpx (int type, const char *user, const char *id, pid_t pid,
UTMPX utmp;
static int wtmpxreboot = 0;
- debug (2, (_("cannot open %s for writing"), WTMP_FILE));
- if (access (WTMP_FILE, W_OK))
+ debug (2, (_("cannot open %s for writing"), WTMPX_FILE));
+ if (access (WTMPX_FILE, W_OK))
{
if (type == BOOT_TIME)
wtmpxreboot++;
@@ -125,7 +148,7 @@ write_wtmpx (int type, const char *user, const char *id, pid_t pid,
--wtmpxreboot;
}
fill_utmp (&utmp, type, user, id, pid, line);
- pies_updwtmpx (WTMP_FILE, &utmp);
+ pies_updwtmpx (WTMPX_FILE, &utmp);
}
void
@@ -135,9 +158,9 @@ write_utmpx (int type, const char *user, const char *id, pid_t pid,
UTMPX utmp;
static int utmpreboot = 0;
- if (access (UTMP_FILE, W_OK))
+ if (access (UTMPX_FILE, W_OK))
{
- debug (1, (_("cannot open %s for writing"), UTMP_FILE));
+ debug (1, (_("cannot open %s for writing"), UTMPX_FILE));
if (type == BOOT_TIME)
utmpreboot++;
return;

Return to:

Send suggestions and report system problems to the System administrator.