[PATCH:sessreg 3/5] If both utmp & utmpx interfaces are available, just use utmpx

Alan Coopersmith alan.coopersmith at oracle.com
Tue Nov 4 19:13:24 PST 2014


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 at oracle.com>
---
 sessreg.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

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
-- 
1.7.9.2



More information about the xorg-devel mailing list