[bug 50940] sessreg-1.0.7: Compilation error in sessreg.c -- undefined *TMPX paths

Thomas Klausner tk at giga.or.at
Fri Jun 15 02:36:07 PDT 2012

Jeremy Huddleston has asked me to send the patch I submitted for the
bug report in the subject to this list for review.

My bug report was:
Compilation of sessreg-1.0.7 on NetBSD-6.99.7/amd64 fails with:
--- sessreg.o ---
  CC     sessreg.o
sessreg.c:257:16: error: use of undeclared identifier 'WTMPX_FILE'
                wtmpx_file = WTMPX_FILE;
sessreg.c:264:16: error: use of undeclared identifier 'UTMPX_FILE'
                utmpx_file = UTMPX_FILE;

NetBSD supports utmpx and wtmpx but does not provide these defines. Similar
defines exist though, _PATH_WTMPX and _PATH_UTMPX. The attach patch serves as a
workaround; a more complete solution might add checks to configure for them
(not provided).

I provided the attached workaround.

A better solution might be to check for these symbols in configure as well.
On NetBSD, both are provided by utmpx.h.
/usr/include/utmpx.h:#define    _PATH_WTMPX             "/var/log/wtmpx"
/usr/include/utmpx.h:#define    _PATH_UTMPX             "/var/run/utmpx"

-------------- next part --------------
$NetBSD: patch-sessreg.c,v 1.2 2012/06/10 16:46:01 wiz Exp $

Make sure file name defines exist on NetBSD.

--- sessreg.c.orig	2011-09-26 23:01:11.000000000 +0000
+++ sessreg.c
@@ -99,6 +99,13 @@ static const char *wtmpx_file = NULL;
 static const char *utmpx_file = NULL;
+#ifndef WTMPX_FILE
+#ifndef UTMPX_FILE
 static int utmp_none, wtmp_none;
  * BSD specific variables.  To make life much easier for Xstartup/Xreset

More information about the xorg-devel mailing list