summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2014-11-04 16:27:57 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2014-11-04 16:31:14 -0800
commit929b2f60c36b80b7a8e6237d5e8ccc981a3a1e0d (patch)
tree4f1f90348409c147d0a98c0d40608c5c041e41f8
parent0a234ecc502b3e08d8f81d51fb724d97e8045504 (diff)
If both utmp & utmpx interfaces are available, just use utmpx
As we already do with wtmp & wtmpx, where only one of the interface sets is compiled in at a time, stop building & potentially calling both the utmp & utmpx interfaces, which could lead to confusion and corruption, especially when xdm passed -u /.../utmpx and sessreg wrote utmp format records to the file instead. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r--sessreg.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sessreg.h b/sessreg.h
index 71e93f1..947f49f 100644
--- a/sessreg.h
+++ b/sessreg.h
@@ -53,7 +53,8 @@
#include <sys/types.h>
#include <time.h>
-#ifdef HAVE_UTMP_H
+/* Prefer POSIX standard utmpx interfaces if present, otherwise use utmp */
+#if defined(HAVE_UTMP_H) && !defined(HAVE_UTMPX_H)
# include <utmp.h>
# define USE_UTMP
#endif