Since UTMPX_FILE is already defined I figure its W counterpart might
as well be defined.

>From a logical standpoint, updwtmpx(3) and utmpxname(3) requires the
path to the wtmp file as an argument, but the location of wtmp is
non-standard and varies by platform. Some packages use WTMPX_FILE as
the "portable" definition of this path.

>From a practical standpoint, the OpenSSH package relies on the
presence of this #define to enable its wtmpx update code during its
build configuration phase, and its wtmpx update code passes WTMPX_FILE
as the first argument to updwtmpx(3).

Despite their appearance the (U|W)TMPX_FILE macros may not be
GNU-isms. It looks like they were added to glibc for compatibility
with some *nix flavors. I found some references in some unexpected
places, such as SCO Unix [1] which puts them in /etc, and SGI Irix [2]
which puts them in /var/adm.

Here's a patch for your consideration:

--- utmps-     2020-12-28
11:33:23.000000000 +0100
+++ utmps- 2021-04-10
07:50:25.454249526 +0200
@@ -67,8 +67,9 @@

-/* Unused, but some packages (ex: procps-ng) require this macro to be
present */
+/* Unused, but some packages (ex: procps-ng) require these macros to
be present */
 #define UTMPX_FILE "/run/utmps/utmp"
+#define WTMPX_FILE "/run/utmps/wtmp"

 /* More old GNU/crap compatibility */
 #define ut_name ut_user

Other than that OpenSSH builds and works fine (on Linux-musl) with
utmps without any code change on either side.

[1] <http://osr507doc.sco.com/en/man/html.F/utmpx.F.html>
[2] <https://nixdoc.net/man-pages/IRIX/man4/utmpx.4.html>

Reply via email to